Source language: Translate to:

IfEx

NeoBook tips, tricks, code samples and more...

Moderator: Neosoft Support

IfEx

Postby Jay-Bird » Sat Sep 02, 2006 7:58 am

Concerning NB IfEx, I am trying to make sure that 1 of 2 Comboboxes has at least a value. According to NB's help file:

Code: Select all
You can also construct more complex statements by combining multiple expressions with “and” and “or”. For example, to find out if [City] equals either “Pittsburgh” or “Washington”:

"[City] = Pittsburgh OR [City] = Washington"

To find out if [City] equals “Pittsburgh” and another variable [Name] also equals “Jones”:

"[City] = Pittsburgh AND [Name] = Jones"

For extremely complex statements you may want to use “(“ and “)” to make sure expressions are evaluated in the correct order.
 
Example:
 IfEx "[Account] = Guest OR [Account] = Admin"
  GotoPage “Welcome”
Else
  AlertBox "Error!" "The account is incorrect."
EndIf


Thats great if [ACCOUNT] has a value (like GUEST) But what if there was NO VALUE in the variable?

So how would one construct an IfEx to prevent an EMPTY value in BOTH Comboboxes? If ONE combobox must have a value.

The following will not work:(Note the Blank Space)
Code: Select all
IfEx "[ComboBox1] =  AND [ComboBox2] =  "
GotoLine "END"
Else

EndIf


But this does:(Using quotes)

Code: Select all
IfEx "[ComboBox1] = [#34][#34] AND [ComboBox2] = [#34][#34]"
GotoLine "END"
Else

EndIf


Now, At least ONE of these comboboxes has to have a value, it cannot be Null.

Just hoping to save someone a little time! I have really enjoyed getting back into the New Neobook and using (discovering) all the Great New Goodies!

Later,
JayBird
User avatar
Jay-Bird
 
Posts: 164
Joined: Fri Apr 01, 2005 7:01 am
Location: Louisiana , USA

Postby Gaev » Sat Sep 02, 2006 8:16 am

Jaybird:

This also works ...
Code: Select all
IfEx "abc[ComboBox1] = abc AND def[ComboBox2] = def"
... abc or def can be any string of at least one character.
User avatar
Gaev
 
Posts: 3733
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby Jay-Bird » Sat Sep 02, 2006 8:24 am

Thats even better :D

Thanks for the tip! IfEx was really a GREAT step forward in my opinion....Saves so much time in code, which results in faster completion time AND faster code execution....

Thanks again Gaev...
User avatar
Jay-Bird
 
Posts: 164
Joined: Fri Apr 01, 2005 7:01 am
Location: Louisiana , USA


Return to NeoBook Knowledgebase

Who is online

Users browsing this forum: No registered users and 0 guests

cron