#1
|
|||
|
|||
Difficulty w/conditional build rule and script expression
Greetings!
I'm having difficulty today with regard to properly evaluting my conditional build rule. It's probably some syntax error either in my build condition expression or the VBScript; I'm hoping someone can point out where I went wrong... Essentially, I have a macro, CMD_COMPONENTFILENAME; I wish to test it for 3 particular values. If it hits, I want to perform all the child steps, and ignore them if CMD_COMPONENTFILENAME is not in the "list" I provide. I have set up a Group step, and have checked the 'Build only if Macro or expression' option, and I've set the expression to: [ValidTP="yay"] and chose "is true" from the dropdown. In the Step tab of the Script Editor for this Step, I have the following VBScript: Option Explicit Function ValidTP() Dim jdav jdav=vbld_AllMacros.Item("CMD_COMPONENTNAME").Valu e If jdav = "API - TP - LD Disconnect" Or jdav="LogManager" Or jdav = "TestApp" Then ValidTP = "yay" Else ValidTP = "boo" End If End Function I'd like to know if ValidTP gets set to "yay" or "boo" and go from there; if I use the Immediate window and evaluate ValidTP when I've set CMD_COMPONENTFILENAME to either of the three strings I'm after, it prints "yay" as expected, and "boo" if anything else. Is my expression in the conditional build rule field incorrect? Do I need some sort of return command? I've tried putting just [ValidTP] in the conditional expression (along with "is equal to" "yay") but that always skips the steps. Hope I was able to describe it clear enough. Thanks in advance for any assitance. -JDAVIDI |
#2
|
|||
|
|||
Move your ValidTP script function from the Step tab to the Project or Global tab and it should work for you. Code on the Step tab is only processed for step script events (vbld_StepStarting, etc.). We could probably update the docs to make this a little more clear.
|
#3
|
|||
|
|||
Success!
Thanks very much, that did the trick!
|
|
|