02-10-2012 02:24 PM
The sequence analyzer is reporting all kinds of errors because I'm indexing the result list.
Can anyone suggest ways to "fix" or "clean up" these errors? I would prefer not to have to justify why I'm not doing anything about errors reported by the analyzer to my QA group.
Solved! Go to Solution.
02-11-2012 10:14 PM
For the first one, you should look at the step property rather than the resultlist (result recording might be disabled at runtime). You'll use a property like RunState.Sequence.Main["stepId"].Result.Status instead.
For #2, I'd need to know the expression, but my best guess is whatever the variable is for indexing the array is initialized to 0. Initialize it to 1 instead if you can.
For #3, you have an invalid escape sequence. "\V" is not valid. If your path ever changed to something like "\Tests", that would really mean "<tab>ests", which wouldn't be the path you wanted. Use two backslashes when you want a backslash in an expression string.
-AllenP
02-12-2012 05:24 PM
For the first one, the whole point is to process the result list to report on any errors that occur during fixture self-test.
For #2, the expression uses step.result.buttonhit as the index into the array, and buttons start at 1.
For #3, if I "fix" the string to contain two backslashes, the file won't open.
Perhaps you now see why I'm a little frustrated with the analyzer.
-Gizmogal
02-13-2012 09:01 AM
For #1, are you iterating over every entry in the ResultList for post-processing? If so, then you can try the following:
PropertyExists("Locals.ResultList[" + Str(Locals.idx) + "].status")?Locals.ResultList[Locals.idx].status=="Error":false
This will check if the property exists before trying to access it, which will cause the analyzer to not whine about it.
For #2, the simplest fix is to change the property of Step.Result.ButtonHit on the instance of the step to be initially 1. You can change this by looking at the Properties tab in the step. That way when the analyzer runs, the ButtonHit value will be valid.
For #3, did you change the value in the station global, or in the constant part of the expression? Your expression should be:
StationGlobals.RootPath & "Configuration\\VP Automated Test Parts and Limit Config.txt"
You shouldn't change StationGlobals.RootPath to have two slashes, since it is a string variable and not an expression.
02-13-2012 09:58 AM
Just want to add:
For 2, another possible workaround is to make your array have an element at [0], just make the value something invalid so that if you end up choosing it due to a bug in your code you will know immediately.
Also 3 does indicate a real problem with your expression. Like Allen said, backslashes are an escape character for string literals in expressions. So if you want an actual backslash in the string you should be using two blackslashes. This only applies to string literals in expressions, do not do this for string values. It should work.
Hope this helps,
-Doug
02-13-2012 10:13 AM
You probably don't want to add anything to ResultsList since when you run the sequence it will append the result to the existing elements, which gives you fake results ahead of the first step.
02-13-2012 10:22 AM - edited 02-13-2012 10:23 AM
Another option, if you have a message that you know is not needed, like #1, you could ignore the warning in the message list and it will never show up again, unless you view the Ignored Messages. Right-click on the message and choose Ignore Message. However, this will only ignore the message on your local machine (unless you have an Analyzer Project file that is shared).
-AllenP
02-21-2012 10:41 AM
Thanks, all, for your suggestions.
The issue with #2 wasn't with the result list, but with custom looping on a step used to create 1-6 button names. Apparently RunState.LoopIndex starts out as 0 even if it's initialized to 1 in the Loop Initialization Expression. I finally "fixed" the problem by using Locals.LoopIndex which I initialized to 1. That really seems to be a bug in the analyzer because it should be looking at that loop initialization expression, not the default value.
For #3 I did change '\' to '\\' and it still worked so I lied about that one . Paths are a pain.
#1 is still giving me trouble, though. If I use the suggested expression:
Locals.AnyErrors = PropertyExists("Locals.ResultList[" + Str(Locals.idx) + "].status")?Locals.ResultList[Locals.idx].status=="Error":False
Then I get the error
Unknown variable or property name 'Locals.ResultList[Locals.idx].status'
(I tried just checking for the existence of the array element without ".status" and got the same error.)
Even though I'm given permission to use it if I'm certain it will evaluate correctly at run time (which I am), I would still like to get rid of the error message, because I'm looking at a lot of the properties of that element and I get the error for each one.
I see that ResultList is an Array of Result which starts out empty. Try as I might I can't create a local Result variable that I can set to the ResultList array element if it exists. What I'd like to do is check for the existence of Locals.ResultList[Locals.idx] and then work with a copy of the result, something like:
Locals.ResultToCheck = Locals.ResultList[Locals.idx]
Is that possible?
02-21-2012 11:19 AM
P.S., just to explain what I'm trying to do here:
I run a fixture self-test at the time the deployed executable is started up. This initializes all the equipment and makes sure it's functional.It calls some of the same sequences that are run during production testing. I want to know about all problems, not just the first one, so I try to let the full self-test complete. The problem reports get printed out automatically so that operators don't have to figure out what to tell the engineers about the problem.
I trap errors in the SequenceFilePostStepRuntimeError callback so that I can report on all errors if the fixture self-test does not succeed (if an error occurs after self-test has passed, execution is terminated). In case of error I force the calling sequence to fail but leave the error condition in the result list. At the end of each sequence called by the fixture self-test, I run the "Report problem" sequence and pass in Locals.ResultList as a parameter. Then I loop through the result list and build a string from all the properties that exist for that result. For example, measurement information:
Locals.Measurement = PropertyExists("Parameters.ResultList[" + Str(Locals.Idx) + "].PassFail") ? "Measurement [" & Str(Parameters.ResultList[Locals.Idx].PassFail) & "] " : PropertyExists("Parameters.ResultList[" + Str(Locals.Idx) + "].Numeric") ? "Measurement [" & Str(Parameters.ResultList[Locals.Idx].Numeric) & "] " : PropertyExists("Parameters.ResultList[" + Str(Locals.Idx) + "].String") ? "Measurement [" & Parameters.ResultList[Locals.Idx].String & "] " : ""
Since I'm looking for the measurement, low limit, high limit, comparison type, and ReportText as well as the status, that is a lot of error messages in the analyzer. But I don't want to suppress the message because it has caught legitimate errors as well.
Hope that helps you understand what I'm after.
- Gizmogal
02-22-2012 09:43 AM - edited 02-22-2012 09:48 AM
You can avoid the analyzer error by doing something similar to the following:
Locals.AnyErrors = PropertyExists("Locals.ResultList[" + Str(Locals.idx) + "].status")?(Locals.ResultList[Locals.idx].GetValString("status", 0) =="Error"):False
To create a copy of the element as a local variable you can do the following:
Locals.SetPropertyObject("myelementVar", PropOption_InsertIfMissing, Locals.ResultList[Locals.idx].Clone("", PropOption_CopyAllFlags | PropOption_DoNotShareProperties))
Note that this property will only exist at runtime, though you can create a placeholder variable there at edit time and it will get replaced by this expression at runtime.
Hope this helps,
-Doug