ISBLANK() function

This forum is for eXpress++ general support.
Post Reply
Message
Author
Victorio
Posts: 620
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

ISBLANK() function

#1 Post by Victorio »

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.

User avatar
Auge_Ohr
Posts: 1405
Joined: Wed Feb 24, 2010 3:44 pm

Re: ISBLANK() function

#2 Post by Auge_Ohr »

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

Victorio
Posts: 620
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

Re: ISBLANK() function

#3 Post by Victorio »

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: Select all

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

User avatar
rdonnay
Site Admin
Posts: 4722
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: ISBLANK() function

#4 Post by rdonnay »

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.

Victorio
Posts: 620
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

Re: ISBLANK() function

#5 Post by Victorio »

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 11066 times
NUL01.gif
NUL01.gif (7.99 KiB) Viewed 11066 times

User avatar
rdonnay
Site Admin
Posts: 4722
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: ISBLANK() function

#6 Post by rdonnay »

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.

Victorio
Posts: 620
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

Re: ISBLANK() function

#7 Post by Victorio »

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.

User avatar
rdonnay
Site Admin
Posts: 4722
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: ISBLANK() function

#8 Post by rdonnay »

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.

Victorio
Posts: 620
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

Re: ISBLANK() function

#9 Post by Victorio »

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.

Post Reply