Thursday
Hi everyone,
I’ve encountered a strange and reproducible behavior in Blue Prism where the InStr() function — and even the Utility - Strings - InStr() → Contains action — do not return correct results until I manually open the Data Item or the Collection cell that holds the string value.
It appears as if Blue Prism only initializes or type-casts the value once it’s been opened in the Debug view.
Env:
Blue Prism version: 7.3.0
All variables are of type Text
Example:
TempName: JonDoe Maximus
Col_TempName: JonDoe
Decision:
InStr([TempName], [Col_TempName]) > 0
Result is False!
When i Click on the Decision Stage and Click on Excecute Value (in new Window) --> Answer is True.
To make sure both sides are Strings, I even created a temporary Data Item [Col_TempName] (Type: Text) and assigned it beforehand.
InStr(Lower("" & [TempName]); Lower("" & [Col_TempName])) > 0
and
Utility – Strings → InStr
Text: [TempName]
Substring: [Col_TempName]
Start Pos: 1
Search Methode: Text and Binary both same Result.
It seems like Blue Prism isn’t initializing or refreshing the internal value until it’s manually accessed.
Thanks in advance for any insights or confirmation from the community or Blue Prism engineers.
sry for Text Style dont know how this happend 🙂
yesterday
Update / Additional Findings
I’ve added a minimal reproducible example to isolate the issue even further.
This shows that the problem is not related to InStr(), but seems to occur whenever a Collection field is used in a Decision before being “initialized” (just my opinion) by opening it in the editor.
Reproduction Steps
1. Create a simple CSV file:
a,b,c,Vorname_1_Person
1,2,3,Jonas
2.Use the following Code Stage snippet to read it into a Collection called [Output Collection].
(Just drop this code into any Process Studio page and run it — it only loads the CSV into the collection. And Proof in a Decision stage named Proof Name with the expression:
"Jonas" = [Output Collection.Vorname_1_Person]
Observed Behavior
When the process runs normally, the Decision always returns False.
When I open the same Decision and click “Evaluate Expression”, it returns True.
In "View Data Item Watches", [Output Collection.Vorname_1_Person] clearly shows "Jonas".
The result remains False until I manually open the Output Collection (no need to switch to Current Values — just open and press OK).
If I open it and then click Cancel, the issue persists. Only confirming with OK initializes it correctly.
Conclusion
This strongly suggests that the issue is not tied to InStr() or data type conversion,
but rather that Collection fields are not internally initialized for evaluation in Decisions until the Collection is opened and confirmed once.
If anyone from Blue Prism or the community can confirm this behavior or knows a reliable way to “force initialize” a collection programmatically, that would be extremely helpful.
<process name="__selection__testprocess1"><stage stageid="1d261c63-af05-43fc-bee9-5c10cc9b2d41" name="Proof Name" type="Decision"><display x="-90" y="330" /><decision expression=""Jonas" = [Output Collection.Vorname_1_Person]" /><onfalse>23d433c2-be03-4ab1-a795-bad5c4890464</onfalse></stage><stage stageid="23d433c2-be03-4ab1-a795-bad5c4890464" name="Anchor1" type="Anchor"><loginhibit onsuccess="true" /><display x="45" y="330" w="10" h="10" /></stage><stage stageid="654855aa-4b91-4409-9245-5ccd15c35feb" name="Utility - Strings::Get Delimited Text As Collection" type="Action"><loginhibit onsuccess="true" /><display x="-90" y="270" /><inputs><input type="flag" name="First Row Is Header" friendlyname="First Row Is Header" narrative="Indicates whether the first row of the CSV file should be treated as headers" expr="True" /><input type="collection" name="Schema" friendlyname="Schema" narrative="Optional. A collection of column names. If left blank the column names will be taken from the first row. " expr="" /><input type="text" name="Delimited Text" friendlyname="Delimited Text" narrative="The delimited text to be converted into a collection" expr="[Text2]" /><input type="text" name="Delimiter Character" friendlyname="Delimiter Character" narrative="The character used for delimiting fields in the string" expr="","" /></inputs><outputs><output type="collection" name="Output Collection" friendlyname="Output Collection" narrative="The collection converted from CSV" stage="Output Collection" /></outputs><onsuccess>1d261c63-af05-43fc-bee9-5c10cc9b2d41</onsuccess><resource object="Utility - Strings" action="Get Delimited Text As Collection" /></stage><stage stageid="a7596608-a13c-4752-a9d6-6557132daddd" name="Output Collection" type="Collection"><display x="-165" y="270" /><datatype>collection</datatype><alwaysinit /></stage><stage stageid="98a36ce7-6c7f-4351-94de-3a9fcc8b439d" name="Utility - File Management::Read All Text from File" type="Action"><loginhibit onsuccess="true" /><display x="-90" y="-75" /><inputs><input type="text" name="File Name" friendlyname="File Name" narrative="The full path the file to read the text from" expr=""C:\Users\XV86X7J\Downloads\antrag.csv"" /><input type="text" name="File Encoding" friendlyname="File Encoding" narrative="Optional. Defaults to UTF8" expr="" /><input type="flag" name="Use BOM" friendlyname="Use BOM" narrative="Optional. Flag indicating whether to use Byte Order Mark with a Unicode encoding. Default is False." expr="" /></inputs><outputs><output type="flag" name="Success" friendlyname="Success" narrative="True if successful" stage="" /><output type="text" name="Message" friendlyname="Message" narrative="An error message if unsuccessful" stage="" /><output type="text" name="Text" friendlyname="Text" narrative="The text of the file" stage="Text" /></outputs><onsuccess>8d7bfe2d-d9e1-4b5f-85bc-717f2b1ac669</onsuccess><resource object="Utility - File Management" action="Read All Text from File" /></stage><stage stageid="0f6b3ecb-a219-46fc-9416-21778cdf3a14" name="Text" type="Data"><display x="-165" y="-75" /><datatype>text</datatype><initialvalue /><private /><alwaysinit /></stage><stage stageid="69c964a3-c1fe-4499-995e-6c725df218ad" name="Utility - Strings::Regex Replace" type="Action"><loginhibit onsuccess="true" /><display x="-90" y="15" /><inputs><input type="text" name="Pattern" friendlyname="Pattern" narrative="The regular expression to use to match for replacement." expr=""[^a-zA-Z0-9äöüßÄÖÜ,]"" /><input type="text" name="Input Data" friendlyname="Input Data" narrative="The string to perform the replacement pattern match on." expr="[Split Values.Value]" /><input type="text" name="Replacement Data" friendlyname="Replacement Data" narrative="The string to use as the replacement data." expr=""_"" /><input type="number" name="Max Count" friendlyname="Max Count" narrative="OPTIONAL: The maximum number of replacements to perform. Default value is unlimited (-1)." expr="" /><input type="number" name="Start Position" friendlyname="Start Position" narrative="OPTIONAL: The starting position with the input data to start the replacement match. Default value is position 0." expr="" /></inputs><outputs><output type="text" name="Output Data" friendlyname="Output Data" narrative="The new string data after the replacement has been performed." stage="Split Values.Value" /></outputs><onsuccess>15a72ead-1216-4efe-9c75-92024375d624</onsuccess><resource object="Utility - Strings" action="Regex Replace" /></stage><stage stageid="8d7bfe2d-d9e1-4b5f-85bc-717f2b1ac669" name="Utility - Strings::Split Lines" type="Action"><loginhibit onsuccess="true" /><display x="-90" y="-30" /><inputs><input type="text" name="Text to Split" friendlyname="Text to Split" narrative="The text to split" expr="[Text]" /></inputs><outputs><output type="collection" name="Split Values" friendlyname="Split Values" narrative="The resulting collection containing the split values" stage="Split Values" /></outputs><onsuccess>69c964a3-c1fe-4499-995e-6c725df218ad</onsuccess><resource object="Utility - Strings" action="Split Lines" /></stage><stage stageid="f59042dc-270f-48dd-8d07-984989d5544d" name="Split Values" type="Collection"><display x="-165" y="-30" /><datatype>collection</datatype><private /><alwaysinit /><collectioninfo><field name="Value" type="text" /></collectioninfo></stage><stage stageid="15a72ead-1216-4efe-9c75-92024375d624" name="Utility - Strings::Regex Replace" type="Action"><loginhibit onsuccess="true" /><display x="-90" y="60" /><inputs><input type="text" name="Pattern" friendlyname="Pattern" narrative="The regular expression to use to match for replacement." expr=""_{2,}"" /><input type="text" name="Input Data" friendlyname="Input Data" narrative="The string to perform the replacement pattern match on." expr="[Split Values.Value]" /><input type="text" name="Replacement Data" friendlyname="Replacement Data" narrative="The string to use as the replacement data." expr=""_"" /><input type="number" name="Max Count" friendlyname="Max Count" narrative="OPTIONAL: The maximum number of replacements to perform. Default value is unlimited (-1)." expr="" /><input type="number" name="Start Position" friendlyname="Start Position" narrative="OPTIONAL: The starting position with the input data to start the replacement match. Default value is position 0." expr="" /></inputs><outputs><output type="text" name="Output Data" friendlyname="Output Data" narrative="The new string data after the replacement has been performed." stage="Split Values.Value" /></outputs><onsuccess>60441b1d-fb43-405c-8ea6-3e2c3609a4c1</onsuccess><resource object="Utility - Strings" action="Regex Replace" /></stage><stage stageid="60441b1d-fb43-405c-8ea6-3e2c3609a4c1" name="Utility - Strings::Regex Replace" type="Action"><loginhibit onsuccess="true" /><display x="-90" y="105" /><inputs><input type="text" name="Pattern" friendlyname="Pattern" narrative="The regular expression to use to match for replacement." expr=""(?<=^|,)_+|_+(?=,|$)"" /><input type="text" name="Input Data" friendlyname="Input Data" narrative="The string to perform the replacement pattern match on." expr="[Split Values.Value]" /><input type="text" name="Replacement Data" friendlyname="Replacement Data" narrative="The string to use as the replacement data." expr="" /><input type="number" name="Max Count" friendlyname="Max Count" narrative="OPTIONAL: The maximum number of replacements to perform. Default value is unlimited (-1)." expr="" /><input type="number" name="Start Position" friendlyname="Start Position" narrative="OPTIONAL: The starting position with the input data to start the replacement match. Default value is position 0." expr="" /></inputs><outputs><output type="text" name="Output Data" friendlyname="Output Data" narrative="The new string data after the replacement has been performed." stage="Split Values.Value" /></outputs><onsuccess>5118d1e8-dbbd-4a8d-98d2-4107314e2c27</onsuccess><resource object="Utility - Strings" action="Regex Replace" /></stage><stage stageid="2f738861-a08d-498e-8efe-1c4dba0b1419" name="Loop Start1" type="LoopStart"><loginhibit onsuccess="true" /><display x="0" y="150" /><onsuccess>54cb793f-d233-4ca5-a0cc-cdcf1be7b7fa</onsuccess><groupid>89495b30-4636-4d4f-8691-ade6154de30c</groupid><looptype>ForEach</looptype><loopdata>Split Values</loopdata></stage><stage stageid="239657f3-bf3b-4f43-b703-a897b2f7b05c" name="Loop End1" type="LoopEnd"><loginhibit onsuccess="true" /><display x="0" y="240" /><onsuccess>8405417f-ba0b-4058-a1cd-2eb586e8af51</onsuccess><groupid>89495b30-4636-4d4f-8691-ade6154de30c</groupid></stage><stage stageid="54cb793f-d233-4ca5-a0cc-cdcf1be7b7fa" name="CreateText" type="Calculation"><loginhibit onsuccess="true" /><display x="0" y="195" /><onsuccess>239657f3-bf3b-4f43-b703-a897b2f7b05c</onsuccess><calculation expression="[Text2] & [Split Values.Value] & NewLine()" stage="Text2" /></stage><stage stageid="51cfbba1-8635-43cf-849f-fb78ebe39659" name="Text2" type="Data"><loginhibit onsuccess="true" /><display x="-165" y="60" /><datatype>text</datatype><initialvalue /><private /><alwaysinit /></stage><stage stageid="8405417f-ba0b-4058-a1cd-2eb586e8af51" name="Anchor2" type="Anchor"><loginhibit onsuccess="true" /><display x="-90" y="240" w="10" h="10" /><onsuccess>654855aa-4b91-4409-9245-5ccd15c35feb</onsuccess></stage><stage stageid="5118d1e8-dbbd-4a8d-98d2-4107314e2c27" name="Anchor2" type="Anchor"><loginhibit onsuccess="true" /><display x="-90" y="150" w="10" h="10" /><onsuccess>2f738861-a08d-498e-8efe-1c4dba0b1419</onsuccess></stage></process>