Jump to content

Text Parsing multiple times into one field


This topic is 2728 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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 ?

Link to comment
Share on other sites

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

 

 

  • Like 1
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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. ?

Link to comment
Share on other sites

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.

 

  • Like 1
Link to comment
Share on other sites

This topic is 2728 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.