PDA

View Full Version : Multiple conditional rules?


charlesm
11-17-2004, 04:17 PM
I would like to have multiple conditional rules before building a group of steps. Is that possible? For instance, do this group of steps if macro1 = False and macro2=1.

Any thoughts?

pjaquiery
11-17-2004, 04:24 PM
Yep. Use script in the expression field (excuse the J-Script):

[! %Macro1% && "%macro2%" == 1]

and select "is true" from the test list box.

charlesm
11-17-2004, 06:40 PM
The script always seems to return as false, I have modified the expression multiple ways and it always seems to return false... strange

pjaquiery
11-17-2004, 08:45 PM
Post an example of the failing test and typical values of any macros you are using

charlesm
11-18-2004, 11:33 AM
The expression is !%isRebuild% && %vBuild% == 1


and it checks to see if it is true

Attached is an example.

Thanks for the help!

pjaquiery
11-18-2004, 02:25 PM
Did you mean:

[!%isRebuild% && %vBuild% == 1]

The [] are what VBP uses to know that it is script.

There in no attachment to your post.

charlesm
11-18-2004, 02:29 PM
I get a parse error when I put the brakets in...

Error expanding macros in property condexpr: <Error at Line 1, Column 1 (Syntax error)
Code: !False && 1 == 1>


trying the attachment again

pjaquiery
11-18-2004, 02:37 PM
The [] are required. You are getting an error because False is not a value that can be inverted with !. %isRebuild% should be set to 0 (false) or a non-zero value (typically -1).

Tip: if you pause your mouse cursor over the expression a tool tip will show the expression with macros expanded.

Mega tip: if you hold down a shift key and pause your mouse cursor over and expression containing script the tool tip will show the result of evaluating the script.

charlesm
11-18-2004, 02:44 PM
I updated the expression to look like this:

[!%isRebuild% && %vBuild% == 1]

and changed the isRebuild macro to 0 and -1 and still get the following results:

Error expanding macros in property condexpr: <Error at Line 1, Column 1 (Syntax error)
Code: !-1 && 1 == 1>

kinook
11-18-2004, 02:44 PM
Also, as was mentioned, this code is JScript syntax, requiring that you set JScript as your default script language (Tools | Options | General). The equivalent VBScript would be

[Not %isRebuild% And %vBuild% = 1]

(assuming that those macros contain values that can be interpreted as boolean/numeric, respectively).

charlesm
11-18-2004, 02:49 PM
That fixed it, I am using VBScript as my default language and used [Not %isRebuild% And %vBuild% = 1] to get the desired results. Thank you for the help!!!!!!

For those interested (I hate when forums don't give you the conculsion), here it the final script....