PDA

View Full Version : Multiple condition evaluation doesn't work


krosty
12-14-2009, 04:34 PM
I have VBP 6.7a. I'm trying to evaluate multiple condition in one line by selecting 'build only if macro or expression' option and putting following expression

[Application.FindMacro("NEED_TO_BUILD").Value = "yes" AND Application.FindMacro("IsItCIBuild").Value = "yes"]

in the condition field

These are obviously mcro values that I've set.

From the drop-down, 'is true' is selected. I've also attached the test .bld file I created for this

The build seems to completely ignore the condition.

I've spend couple of hours on this and I'm getting frustrated

BTW, I got the above expression in one post in this forum that was made 3/4 years ago

kinook
12-14-2009, 06:41 PM
I don't see an attachment.

http://www.kinook.com/Forum/showthread.php?threadid=927

http://www.kinook.com/Forum/showthread.php?threadid=3044

http://www.kinook.com/VisBuildPro/Manual/tooltipfeatures.htm

krosty
12-15-2009, 09:47 AM
Here's the attachement

kinook
12-15-2009, 11:12 AM
In the project you attached, the NEED_TO_BUILD and IsItCIBuild macros both have a value of no, so the rule evaluates false and the Condition and Log Message steps are skipped. If I change both macro values to yes and rebuild, the rule evaluates true and those steps are built.

If you hold down the Shift key when hovering the mouse cursor over the Build Rule column checkbox in the Project Steps pane, the tooltip will indicate whether the rule evaluates true or false; or hovering over the rule expression in the Step Properties dialog with Shift down will show the evaluated expression (0 = False, non-zero = True).

krosty
12-15-2009, 11:56 AM
The step is building even with those two macros set at no (the expression should evaluate to 'false and false =false' and the step should be skipped. But the 'log message' step is building and that's what the problem is

kinook
12-15-2009, 11:59 AM
Make sure that 'Tools | Application Options | General | Implement nesting of conditional build rules' is checked.
http://www.kinook.com/VisBuildPro/Manual/miscopt.htm

krosty
12-15-2009, 12:50 PM
It is checked. For all combinations of boolean values (false+true,true+false,false+false, true+true), the coditional step is executing. It should execute only for true+true, since its AND the first three should evaluate to false forcing a skip of the step

kinook
12-15-2009, 12:58 PM
You're definitely doing a Rebuild and not Rebuild Selected? And you're getting build output of

Step 'Condition' build rule evaluates true: [Application.FindMacro("NEED_TO_BUILD").Value = "yes" AND Application.FindMacro("IsItCIBuild").Value = "yes"] is true

when the macro values are not both yes?

The rule has the expected result here -- the Condition and Log Message steps are skipped for all combinations except yes+yes.

krosty
12-16-2009, 09:55 AM
You are right. Instead of highlighting steps and selecting to rebuild, I just kicked of build from command-line and it worked. Thx for the help