Jump to content
Macro Express Forums

How Do I Tell If A Text Var Is Empty?


Cory

Recommended Posts

I want to stop a loop when there are no more records. Eventually one of the text var’s will be null but I can’t find an elegant way to determine this. We have all these comparisons in the If Variable command but the “Null” option is missing. <g> I tried “=” then left the value empty but that doesn’t work. Is there a trick I’m missing here?

 

So far the best I can come up with is to count the number of characters and stick that in an integer var. Then do an If Variable N1 = 0 which works but seems like an extra step.

 

Any ideas?

Link to comment
Share on other sites

Hello Cory!

 

Not sure what your code looks like, but testing for an empty string variable does work. Here is an example:

 

<IFVAR2:1:01:1:><TBOX4:T:4:CenterCenter000250000125:000:Empty Variable
                  Variable T1 is empty!><ENDIF>

 

There is a difference between an "empty" string and a NUL string in Macro Express as in all other programming languages, script or otherwise. NUL is a real character (ASCII 0) and it can be counted. If you have a string of 10 NUL characters, then the string length would show as 10.

Link to comment
Share on other sites

Dang, I tried that but it didn't work for me. I must have messed up in there somewhere.

 

Interesting about null. Mathamatically null is nothing, devoid, empty. An empty set. I'll have to mind my words then when speaking in the programming world. Thanks for the edification!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...