In my sequence, the SequenceFilePreStep callback checks if a step is a test step (ex. NumericLimitTest). If it is, a temperature value from a global array has to be stored to the step's Additional Results. Let's say the temperature array index is just zero here. I use the following statement then.
The problem is that the variable name is evaluated as a number, which is the same as the temperature value. (Please refer to the attached image) But it doesn't even allow me to use some arbitrary name such as "Temp". It forces me to use "FileGlobals.Temperature" as the variable name. Otherwise, I get an error. How can I assign a variable name in the Additional Results as I want?
Another question is, is it possible to check whether a variable with a cerain name in the Additional Results exists, using expressions? Basically, I want to replace an old temperature value in the Additional Results with a new value whenever a loop iterates.
Any input will be appreciated.
Solved! Go to Solution.
The first parameter for the Insert method needs be a string and also evaluate to a string. You are correctly giving a string to this first parameter, but it evaluates to a number (50). And if you use "Temp", it tries to evaluate it as a variable, which doesn't exist. Try this expression:
Actually, the result name is an expression rather than just a string (you can see this by going to the Additional Results section of the Step Settings and looking at the visual editor for Additional Results entries). Therefore, you need to include another set of double quotes in your name expression. Here is an example:
The backslashes escape the inner set of quotes so that they are interpreted properly when the expression is run.
Hope it helps!
The double quote trick certainly worked!
The remaining problem is that I have to replace old additional result values with new ones for every loop iteration.
Is it possible at all to use some method like Exists to check whether an additional result with a certain name already exists and get its array index?
I need to record the most recent temperature value for every test step and some test steps have their own unique additional results, too.
Tracking additional results by name would be a sure-fire way if possible.
I suppose I should go with this way.
FileGlobals.AdditionalResultsCount = RunState.CallingStep.AdditionalResults.CustomResults.Count
For Locals.LoopIndex = FileGlobals.AdditionalResultsCount -1; Locals.LoopIndex >=0; Locals.LoopIndex -= 1
If RunState.CallingStep.AdditionalResults.CustomResults.Item(Locals.LoopIndex).Name == "\"Temperature\""