bb.donnay-software.com

Donnay Software Web Forums
It is currently Wed Aug 12, 2020 2:04 am

All times are UTC - 7 hours




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: ISBLANK() function
PostPosted: Thu Mar 05, 2020 3:07 am 
Offline

Joined: Sun Jan 18, 2015 11:43 am
Posts: 524
Location: Slovakia
Hi,
Exist some replacement for function ISBLANK() (Visual Foxpro) ?

I need determine numeric field in DBF database (no SQL, only VFP DBF) when value is blank or 0
Function empty() return .T. in both variants but VFP function return .T. only when numeric field is blank.


Top
 Profile  
 
 Post subject: Re: ISBLANK() function
PostPosted: Thu Mar 05, 2020 4:01 am 
Offline
User avatar

Joined: Wed Feb 24, 2010 3:44 pm
Posts: 1189
Hi,
Victorio wrote:
Exist some replacement for function ISBLANK() (Visual Foxpro) ?

I need determine numeric field in DBF database (no SQL, only VFP DBF) when value is blank or 0
Function empty() return .T. in both variants but VFP function return .T. only when numeric field is blank.

have a look at "SET NULLVALUE"

_________________
greetings by OHR
Jimmy


Top
 Profile  
 
 Post subject: Re: ISBLANK() function
PostPosted: Thu Mar 05, 2020 4:38 am 
Offline

Joined: Sun Jan 18, 2015 11:43 am
Posts: 524
Location: Slovakia
Hi Jimmy,
I found SET NULLVALUE, I am testing also ON OFF, but no effect.
Only when I add NULL parameter to structure in Visual Foxpro and then when I add NIL value to field , then can test ISNULL()

But I do not know how add NUL parameter to DBF structure from Xbase++

this do not work not accept parameter nullable, however this is in Xbase++ manual in example for function
Code:
aStruct:=DbStruct()
aadd(aStruct,{'TYP_ZM','N',2,0,"nullable"})
lupdstru:=DC_STRUUPDATE(aStruct,,,,.F.)


but this do not work not accept parameter nullable, however this is in Xbase++ manual in example for function :

// The sample illustrates how DbSetNullValue()
// affects the Null value representation of a
// field which is nullable.
PROCEDURE Main()
LOCAL aStructure := {}

AAdd( aStructure , { "LASTNAME" , "C" , 20 , 0 } )
AAdd( aStructure , { "REVENUE" , "N" , 8 , 2 , "nullable" } )
AAdd( aStructure , { "CONTACT" , "D" , 8 , 0 , "nullable" } )

DbCreate("Customer",aStructure,"FOXCDX")
USE Customer EXCLUSIVE VIA FOXCDX

DbAppend()
FIELD->LASTNAME := "Joe Doe"

// result: "Joe Doe 0 . . "
//
DbSetNullValue(.F.)
? FIELD->LASTNAME, FIELD->REVENUE, FIELD->CONTACT

// result: "Joe Doe NIL NIL"
//
DbSetNullValue(.T.)
? FIELD->LASTNAME, FIELD->REVENUE, FIELD->CONTACT


Top
 Profile  
 
 Post subject: Re: ISBLANK() function
PostPosted: Thu Mar 05, 2020 4:43 am 
Offline
Site Admin
User avatar

Joined: Wed Jan 27, 2010 6:58 pm
Posts: 4149
Location: Boise, Idaho USA
There are no NULL values in a DBF file.

You should use Empty() instead of IsBlank().

_________________
The eXpress train is coming - and it has more cars.


Top
 Profile  
 
 Post subject: Re: ISBLANK() function
PostPosted: Thu Mar 05, 2020 5:23 am 
Offline

Joined: Sun Jan 18, 2015 11:43 am
Posts: 524
Location: Slovakia
Hi Roger,
In Visual Foxpro ver 5 I can add NULL parameter for any fields in DBF file.
After this I can put NIL value to dbf also from Xbase++ and after this test with ISNULL() and this works.

Only problem I have, that I cannot change structure DBF file from Xbase , only from Visual Foxpro. It is oddly, because after add NULL Xbase also accept this and enable write .NULL. to dbf.
Here are printscreens from VFP where dialog for modify structure and after this in one row .NULL. value

and empty() function not distinguish between no value and zero when numeric fields.

And here :
Structure of e0050898
Field/name type length offset fieldflag AutoIncr AutoIncr
in rec NextValue StepValue
----------------------------------------------------------------------
1 CPA N 9.0 1
2 CPU N 2.0 10 Null values ok
3 VYM N 8.0 12 Null values ok
4 KVV N 1.0 20
5 DRP N 2.0 21

is visible than parameter Null values ok for DBF file.

But I mean, know where is problem, it looks to problem with struupdate where Xbase have only 4 elements for structure and this NULL is 5th.
Or something around this.

Now I have only way to create own sample databases with VFP and use it to copy content tables in XBase, when I need use NULL values.


Attachments:
NUL02.gif
NUL02.gif [ 5.12 KiB | Viewed 2347 times ]
NUL01.gif
NUL01.gif [ 7.99 KiB | Viewed 2347 times ]
Top
 Profile  
 
 Post subject: Re: ISBLANK() function
PostPosted: Thu Mar 05, 2020 8:03 am 
Offline
Site Admin
User avatar

Joined: Wed Jan 27, 2010 6:58 pm
Posts: 4149
Location: Boise, Idaho USA
You may be able to do this by using ADS and local server via a SQL statement.

This can be done entirely in Xbase++ code.

Let me know if this interests you and I will dig into this for you.

I will need a copy of your database (with nulls) to write a test program.

Do do not need to purchase ADS for this because it uses only the client-side DLLs.

_________________
The eXpress train is coming - and it has more cars.


Top
 Profile  
 
 Post subject: Re: ISBLANK() function
PostPosted: Thu Mar 05, 2020 8:33 am 
Offline

Joined: Sun Jan 18, 2015 11:43 am
Posts: 524
Location: Slovakia
Thank you for answer. Now I test create dbf with DbCreate, this looks will work .
When create dbf with structure in aStruct array and have also "nullable" element, database created.
Only with DC_Struupdate later, when DBF is already created cannot change this element. But this is not problem, when I can use DbStruct.

Only I need test it because some time ago I had problem with open database created in Xbase in Visual Foxpro when created with DbCreate When create with Copy stru to this works.

I will write, if my solution will not work.
I am interesting about ADS but this work only with proffesional edition Xbase++ , right ?
I have Foundation.


Top
 Profile  
 
 Post subject: Re: ISBLANK() function
PostPosted: Thu Mar 05, 2020 9:45 am 
Offline
Site Admin
User avatar

Joined: Wed Jan 27, 2010 6:58 pm
Posts: 4149
Location: Boise, Idaho USA
Quote:
I am interesting about ADS but this work only with proffesional edition Xbase++ , right ?


Yes, that is correct. It requires ADSDBE.

_________________
The eXpress train is coming - and it has more cars.


Top
 Profile  
 
 Post subject: Re: ISBLANK() function
PostPosted: Fri Mar 06, 2020 2:40 am 
Offline

Joined: Sun Jan 18, 2015 11:43 am
Posts: 524
Location: Slovakia
Hi,
At this moment I have some solution.
First before open any database I set DbSetNullvalue(.F.)
without it if in DBF file is nullable enabled for some field, indexing CDX crashing
Next I can store .NULL. values to fields in database

when I want test if field is .NULL. I must DbSetNullvalue(.T.) , this works fine

but after processing using NULL values I must remove all NULL values from DBF , this mean replace it with zero, "" or blank date,
without it program crashing when use set order to... with error index key not enabled null values or something like this.

Now I testing if no other problem will be with this system.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group