Source language: Translate to:

If / while options

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

Postby Gaev » Tue Feb 07, 2006 11:16 am

something:

Not sure what logic you are trying to invoke ...
Code: Select all
If "[varPage1Yes]" "=" "Yes"
If "[varPage2Yes]" "=" "Yes"
If "[varPage3yes]" "=" "Yes"
and so on
dbfQuery "[PubDir]order.dbf" "APPVAR=varPage1Yes OR APPVAR=varPage2Yes OR APPVAR=varPage3Yes"

Do you mean "all three variables contain the value "Yes" ? If so ...

a) You can test for it like so ...
Code: Select all
If "[varPage1Yes][varPage2Yes][varPage3yes]" "=" "YesYesYes"
     dbfQuery ....
EndIf


b) Your query ...
Code: Select all
dbfQuery "[PubDir]order.dbf" "APPVAR=varPage1Yes OR APPVAR=varPage2Yes OR APPVAR=varPage3Yes"
... which you probably meant to say ...
Code: Select all
[PubDir]order.dbf" "APPVAR=[varPage1Yes] OR APPVAR=[varPage2Yes] OR APPVAR=[varPage3Yes]"
... would end up looking for records where APPVAR=Yes OR APPVAR=Yes OR APPVAR=Yes"... kind of redundant ?

... or did you mean "any one of the three variables contain the value "Yes" ?

Assuming you meant "all three variables contain the value "Yes", try something like this ...
Code: Select all
If "[varPage1Yes][varPage2Yes][varPage3yes]" "=" "YesYesYes"
     dbfQuery "[PubDir]order.dbf" "APPVAR=[#34]Yes[#34]"
     Return
EndIf
If "[varPage1Yes][varPage2Yes][varPage3yes]" "=" "YesNoYes"
     dbfQuery "[PubDir]order.dbf" "APPVAR=[#34]Yes[#34]"
     Return
EndIf
etc
User avatar
Gaev
 
Posts: 3728
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby SpiritHorse_ » Fri Apr 28, 2006 10:40 am

optionally if you have nb version 5 ^ you can code it this way using the IfEx

IfEx "([varPage1Yes]=Yes) and ([varPage2Yes]=Yes) and ([varPage3yes]=Yes)"
dbfQuery "[PubDir]order.dbf" "APPVAR=[#34]Yes[#34]"
Return
EndIf
IfEx "([varPage1Yes]=Yes) and ([varPage2Yes]=No) and ([varPage3yes]=Yes)"
dbfQuery "[PubDir]order.dbf" "APPVAR=[#34]Yes[#34]"
Return
EndIf


keep in mind that for some reason you can only evaluate 3 variables at a time per IfEx command <<< I have no Idea why this is but it is
User avatar
SpiritHorse_
 
Posts: 32
Joined: Thu Mar 31, 2005 11:11 pm
Location: New Mexico,USA


Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 1 guest