January 13, 201115 yr Hi, I'm looking for a solution to find a 'pattern' in a string (not a value!), and then substitute it with another value. This substitution should be done through a script. Practically, the string looks like this: "99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999" Each of the 9-s above represents a number from 0 to 9. Each group contains 5 numbers. I use this string (=field) to link this table to another one. I would now like to limit the found records in the related table, by 'voiding' those lines in the string above that contain more than 3 groups of 99999-s. The result-string should look like this: "99999 99999 99999 99999 99999 x 99999 99999 99999 99999 99999 99999 99999 99999 99999 99999 x 99999 99999" (x being a normal "x" to assure a value that has no related records, without deleting the line so that i can still re-use it afterwards) Any profis around who ran into a similar thing? rgds,
January 13, 201115 yr Each of the 9-s above represents a number from 0 to 9. There is no pattern to find here. You should loop through the values, testing for the value's length. If it's more than 17, skip the value - otherwise include it in the result. This could be calculated using a custom function, or use a looping script to populate the result field.
January 13, 201115 yr Author There is no pattern to find here. You should loop through the values, testing for the value's length. If it's more than 17, skip the value - otherwise include it in the result. This could be calculated using a custom function, or use a looping script to populate the result field. Mmm, thanks Comment ... which means i need to check character for character on a 'return' to find out where the line starts and ends ... or is there an instruction that reads an entire line at the time as well?
January 13, 201115 yr Use the GetValue() function, in conjunction with a incrementing counter, e.g.: Loop Set Variable [ $i ; $i + 1 ] Exit Loop If [ $ i > ValueCount ( SourceField ) ] Set Variable [ $v ; GetValue ( SourceField ; $i ) ] If [ WordCount ( $v ) ≤ 3 ] Set Field ( TargetField ; List ( TargetField ; $v ) ] End If End Loop Commit Records []
Create an account or sign in to comment