Carriage Return Text Search in Python STK


Hi,
A particular Short Text attribute in a table has been filled with texts ending with carriage returns, but not on all records. In an effort to tidy up the data, the admin is developing a script whose intent is to search for records where the attribute value contains a carriage return.
Is it possible in the STK to use the "search_for_records_where" function calling a text search criteria with an ASCII code for carriage returns or special characters ? Basically, something like this :
base_contains_iron = base_attribute.search_criterion(contains='Fe (Iron) \r\n')
iron_records = material_universe.search_for_records_where([base_contains_iron])
Thanks in advance !
Mickaël
Best Answer
-
Hi Mickael-san
I checked in my environment (local environment of Windows Server 2019).
Carriage returns could not be detected by "search_criterion" and "search_for_records_where",
so it can be detected by whether special characters are included in record.attributes['attribute'].value.A similar error, "Search.CriteriaSearch failed with code 500", occurred when searching for using only space or CR.
1
Answers
-
!----UPDATE----!
After a test done on Granta MI 2023 R1 with Python STK 3.1, I am getting the following error :error message transcripted below :
Search.CriteriaSearch failed with code 500 and message: The server was unable to process the request due to an internal error.
For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior)
on the server in order to send the exception information back to the client,
or turn on tracing as per the Microsoft .NET Framework SDK documentation and inspect the server trace logs.0 -
Final update :
Carriage returns could not be detected by "search_criterion" and "search_for_records_where",
so it can be detected by whether special characters are included in record.attributes['attribute'].value.Thank you Toshihiko-san for your input.
0