October 8, 20169 yr Hi All, I am trying to parse text from a Job Card Items table into the related Job Card and not getting the correct result.. as the Items in the Job Card are completed any anomalies have to be reported on the Job Card and with up to 50 items in the Job Card Items there may be more than one anomaly to report, (very rarely more than two) . If the Findings field is empty I am just inserting the Variables but when the field already contains data I am using this to parse the text: Position ( JobCard::Findings ; ":" ; 1 ; 1 )&¶ & $ProdName &" "& $ItemLocation & " " & $QItemSerial On the second insertion I am getting this: PR00023 FC iLLume Unit FC0000084 Unit damaged:46 PR00023 FC iLLume Unit FC0000084 Where is the 46 coming from ?
October 8, 20169 yr 40 minutes ago, Oyseka said: Where is the 46 coming from ? What do you expect to get as the result of: Position ( JobCard::Findings ; ":" ; 1 ; 1 ) ? I am not sure what exactly you're trying to achieve here. If the target field already contains data, and you want to append new information to the existing data, you should be setting the field to: JobCard::Findings & ¶ & $ProdName &" "& $ItemLocation & " " & $QItemSerial
October 8, 20169 yr Author Thank you so much comment. I had never tried to parse into a single field more than once so I thought, (obviously erroneously), that I had to set a starting position for the next text to be appended.
October 8, 20169 yr 10 minutes ago, Oyseka said: I thought, (obviously erroneously), that I had to set a starting position for the next text to be appended. You would have to know the starting position only if you wanted to insert the new text into the existing one. Then you would use this position in a calculation using the Replace() function, for example.
October 8, 20169 yr Author If I had used INSERT, having got the cursor position that I wanted to INSERT from, how would I specify that in the calculation as I can see no PositionCursor step. ?
October 8, 20169 yr The cursor position is irrelevant if you're doing this within a Set Field[] step. Just to make this point clear: you could make your script place the cursor at the wanted position using the Set Selection[] script step, then use the Insert Calculated Result[] step to insert new text at that point. But that's not what I meant. Unless you are assisting the user in data entry, it's best to stay at the data level and modify the field's value using Set Field[], without entering the field. Within the Set Field[] calculation, you can use the Replace() function to insert new text at a calculated position. For example, if the target field contains: First sentence. Last sentence. then setting it to: Replace ( Target ; Position ( Target ; ". " ; 1 ; 1 ) + 2 ; 0 ; "New sentence. " ) would result in: First sentence. New sentence. Last sentence.
Create an account or sign in to comment