02-27-2009 12:23 PM
02-27-2009 01:43 PM
Nothing will trigger a failure or error just from these settings. The only thing that is happening is the Step.Result.Error.Code variable will be set to the return value. Setting the code will never change the status of the step. However, the status expression may be using this value to determine the result, depending on how it is set.
Allen P.
NI
02-27-2009 02:01 PM
That helps. Thanks.
The Status Expression used in the DLL calls looks like this:
Step.DataSource != "Step.Result.PassFail" ? Step.Result.PassFail = Evaluate(Step.DataSource) : False,
Step.Result.PassFail ? "Passed" : "Failed"
What's the Step.DataSource variable?
02-27-2009 02:22 PM
02-27-2009 02:31 PM
On the step's Properties screen, under the General tab, there's a button named 'Edit Pass/Fail Source...' This button pops up a window that shows the Data Source Expression:
Step.Result.PassFail = (Step.Result.Error.Code == 1)? 1:0).
02-27-2009 02:40 PM
Correction to above:
Step.Result.PassFail = (Step.Result.Error.Code == 1)? 1:0
02-27-2009 03:13 PM
This means the step will pass when the return code is 1 and fail when it is not 1. It also assigns the pass/fail status to the Step.Result.PassFail variable (which is not neccesary since it is already being copied in the Result Expression). The code could be simplified to the following:
Step.Result.Error.Code == 1
The ? 1:0 part is unneccesary (and partially unclear, since it would be more readable with true and false instead of 1 and 0).
Assigning to the Step.Result.PassFail variable is also not needed since the Status Expression does the same thing.
Allen P.
NI
03-02-2009 07:16 AM
I have another question about the Status Expression used in the DLL call (copied below):
Step.DataSource != "Step.Result.PassFail" ? Step.Result.PassFail = Evaluate(Step.DataSource) : False,
Step.Result.PassFail ? "Passed" : "Failed"
I'm having trouble parsing the Status Expression in my mind so I understand what's going on. Is there a document indicating the order in which operators and functions are evaluated....the 'order of precedence'?
03-02-2009 10:27 AM
I am not aware of a specific document that describes the order of operations, but it should be nearly identical to C syntax.
The basics of that expression are as follows:
If the data source is not Step.Result.PassFail (not the default case), Evaluate the Step.DataSource property and store the result in Step.Result.PassFail. Otherwise do nothing. The comma means there is new statement, and the last statement is what assigns the result status to the step (this must be a string). It the PassFail variable is true, it sets the step to "Passed", otherwise it sets it to "Failed".
Allen P.
NI