Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can i know when a string is null? clarion 6.3/wxp

Status
Not open for further replies.

RobertoMexicali

Programmer
May 2, 2003
39
MX
Hi, i used to work with clarion 5 and when i need to know if a string variable is empty i ask this:

if ~var:string then var:string = 'value'.

but with clarion 6.3 this dont work, i have been trying:

if len(clip(var:string)) = 0
if null(var:string)
if ~var:string

when i message the value of the variable it returns me 100 (the lenght of the string)

is anybody knows a function or command that indicates me when a variable has'not value?

thanks
 
Hi!

How do you know that the VAR:String is empty. Also C6.3 has some wierd behaviour when you use reserved names which STRING is. So, the first thing is to rename it to something like String1.

if len(clip(var:string1)) = 0 ! should work
if ~var:string1 ! should work
if var:string1 <> '' ! should work

Also if VAR:String1 is STRING(100) and you do a VAR:String = ALL('<0>',100) and then check the length, it will be 100 because a string can contain binary information which <0> is. However if VAR:String1 is defined as CSTRING(101), it should work fine.

Regards
 
Hi ShankarJ, thanks for answer. How do i know that the var is empty? beacuse the file i'm using only had one record (it's a company parameters file)

By the way, var:string is just a name, i was pretending to do more clear the example, in fact, this is the real code i'm using: (after ?PAR:Direccion accepted)

if ~PAR:Reporte2 then PAR:Reporte2 = PAR:Direccion.
display

since i dont have the result i was expecting, i puted a button with these messages:

message(len(clip(PAR:Reporte2))) !it message '100'
if PAR:Reporte2 = '' then message('nulo1'). !doesn t message
if PAR:Reporte2 = ' ' then message('nulo2').! doesn t mess
if ~PAR:Reporte2 then message('nulo3'). doesn t mess
if left(PAR:Reporte2) = '' then message('nulo4'). doesn t m.

 
I found the problem, when i created the only record of the file paramet i was doing this:

if records(paramet) = 0 then add(paramet).

i only added:
if records(paramet) = 0 then CLEAR(PAR:RECORD);add(paramet).

the first routine i always put in on my programs, for one reason doesn't work this time, i don't know if it's for C6.3 or maybe the new laptop i just bought, it's a AMD Turion64 with WXP SP2, anyway, no more problems

thanks ShankarJ for answer, see you in a future (i like to read your posts, very usefuls)

regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top