PDA

View Full Version : Evaluating return value of script


ChrisF
06-10-2010, 10:29 AM
Using VBPro v7.2

I have a Run Script step, which has a VBScript. The VBScript runs a function in a Access DB, and the Access DB function returns a -1 on fail, an 0 on pass. How can I make my Run Script step use the return value of my Access DB function, so I can evaluate a pass/fail condition on the Run Script step? Thanks!

kinook
06-10-2010, 10:46 AM
If AccessDBResult Then Step.BuildStatus = vbldStepStatFailure

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

ChrisF
06-22-2010, 12:23 PM
I'm usually good at reading between the lines, but I wasn't sure on this one. So where would I put the above If statement? Also the link you gave talked about evaluating a vbld_* function status, but couldn't make out with the instructions either. Thanks!

kinook
06-22-2010, 01:00 PM
You said "I have a Run Script step, which has a VBScript. The VBScript runs a function in a Access DB, and the Access DB function returns a -1 on fail, an 0 on pass." So the If statement (obviously adjusted to actually check the result of your function) would go in the VBScript code after the call to the Access DB function.

I was referring to the help in that topic which states "The step's BuildStatus property can be set to vbldStepStatFailed in the script code to signal failure of the step."

ChrisF
06-22-2010, 01:43 PM
So I have something like this in the VBScript that's in the Run Script step?

if MyAccessDBFunction == 0 then
Step.BuildStatus = vbldStepStatSucceeded
else
Step.BuildStatus = vbldStepStatFailed

kinook
06-22-2010, 01:57 PM
That works too (except = is VBScript equality, not ==). -1 (non-zero) equates to True in VBScript, and succeeded is the default status, so

If MyAccessDBResult Then Step.BuildStatus = vbldStepStatFailure

should also work.

ChrisF
06-22-2010, 02:47 PM
I see what you mean now by your first reply. Thanks!

ChrisF
06-22-2010, 04:14 PM
Originally posted by kinook
That works too (except = is VBScript equality, not ==). -1 (non-zero) equates to True in VBScript, and succeeded is the default status, so

If MyAccessDBResult Then Step.BuildStatus = vbldStepStatFailure

should also work.

This wored!Thanks again.

If MyAccessDBResult Then Step.BuildStatus = vbldStepStatFailed