Hi All,
We're in the midst of upgrading from 7.5 to 8.5 and I've noticed a quirk in how the contains() function works that's causing a couple of our 7.5 applications to break. If the array in contains(@arr,value) only has a length of 1, the contains() statement will return false for matching values where the data type doesn't match. If the array is a true array containing multiple values, then it doesn't seem to care about data types at all.
Please see attached protocol and screenshot. Any guidance? Is this a known bug?
Best regards,
Scott

Hello Scott,
I just recreated your protocol in PP 7.5 and see exactly the same results. I am attaching a version I built in 7.5 for you to try. I also added a branch that explicitly changes the propertytype of your list property and you can see that it address the first case where there is only a single scalar variable being compared. When property types do not match (scalar vs array, double vs string) Pipeline Pilot tries to recast the values for you to do something sensible, but seems to be failing in your specific case of a scalar string value being compared to a scalar double that is expected as an array.
It is a bit quirky and I will enter a bug report to ensure it gets formally evaluated, however given that it works identically in 7.5 I think there may be more behind the reason that your protocol is failing in 8.5.
Best wishes,
Lynn
Accelrys Support
Hi Lynn,
Thanks for the prompt response. You're absolutely right... there is more to the story.
It looks like the change in behavior is in the visual selector I'm also using. Here's a protocol you can save in your user directory that more closely mimics the behavior I'm observing. In 7.5, this protocol always passes the selected index values (@selection) as a string array, even if you only select a single box. In 8.5, it more precisely types the array as a string if you only select a single letter. That in conjunction with the quirk in contains() conspired against me!
Very easy to correct now that I understand the problem.
Thanks for your help!
-Scott
Hello,
Nicely demonstrated. I have also entered this result type change as a separate report.
Please email me at miller@accelrys.com and I will create an official ticket to link to the reports.
Best wishes,
Lynn
Hi Scott, Lynn,
Just FYI I have seen this "quirk" as far back as PP 6.0 ... I have several old protocols that append a dummy value onto the front of a returned array before using contains, just to ensure that the array will have at least two variables in it and the call will always return the correct answer.
Best,
Jennie