Question

Attempting to Convert String data to multiple outputs

  • 28 October 2019
  • 9 replies
  • 1 view

Badge

Hi guys,

I need to convert the current source data I have which comes in the following format and need to it to come out as the output below.

The conversion aspect of it I can get working but the issue is I want a concurrent list of IDs that is based on the source data. So all the outputs should be unique unless they are the same as the source data. What would be the best way to do this? Using the substring extractor and substring replacer has worked to a certain extent but not to complete convert all the Ids to the suggested output of 9 digit example below

Source Data

EXM12345 - ID

EXM12346 - ID

EXM12347 - ID

 

Output required

EXM-10001 - ID required

EXM-10002- ID required

EXM-10003- ID required

 

Once mapped

EXM12345 = EXM-10001

EXM12346 = EXM-10002

EXM12347 = EXM-10003

 


9 replies

Badge

Am I taking you too literally or will this do? :)

Badge +21

Suggested approach. Generating the unique IDs at the bottom - and merging them with the original features with a Featuremerger afterwards. Might be a start if I understand correctly?

Badge

Am I taking you too literally or will this do? :)

Thanks, this is close to what i was after. The output was something like EXM-10001 based on the original source data which would be EXM12345.

 

Thanks

Badge

Suggested approach. Generating the unique IDs at the bottom - and merging them with the original features with a Featuremerger afterwards. Might be a start if I understand correctly?

I am struggling to understand where the output would be: EXM-10001 if based on EXM12345, where this change occurs?

Badge

This is a output that is required if it makes sense.

Current Data i have is ID:

I want it to convert it to another column based on the source data. The counter does not work as it seems to only doing it based on the row and gives it a unique identifer. Also trying to work out how it can give it a identifer with EXM-XXXXXX after it.

 

ID (Source Data) Output based on ID

 

EXM12345

EXM-100001

EXM12346

EXM-100002

 

EXM12347

 

EXM-100003

 

EXM12345

 

EXM-100001

 

Userlevel 4
Badge +13

I am struggling to understand where the output would be: EXM-10001 if based on EXM12345, where this change occurs?

The "newID" is brought back to the original data in the Feature Merger. I think @sigtill's solution will work nicely. If you want to have the count for the new ID to start at 100,000 you just set up the Counter ot being then. The DuplicateFilter is important here as it ensures you only generate one ID for each unique original ID.

Badge

This is a output that is required if it makes sense.

Current Data i have is ID:

I want it to convert it to another column based on the source data. The counter does not work as it seems to only doing it based on the row and gives it a unique identifer. Also trying to work out how it can give it a identifer with EXM-XXXXXX after it.

 

ID (Source Data) Output based on ID

 

EXM12345

EXM-100001

EXM12346

EXM-100002

 

EXM12347

 

EXM-100003

 

EXM12345

 

EXM-100001

 

Then I think the solution @sigtill described is the one to go for, just maybe with a Sorter between the DuplicateFilter and the Counter.

 

The key is that you use the lower part of @sigtill's workspace to create your translation table, where I understand that you want your output to be EXM- followed by 100001 and upwards in increments of one, connected to your source IDs in order.

 

The upper part of the workspace sends all the features, duplicates or not, straight through and then the FeatureMerger gives them their new ID based on the translation table.
Userlevel 1
Badge +21

Assuming that the number can be assumed based on the existing value minus 12344 + 10,000, this should work. Identify the number in the expression, calculate the new numerical value, replace the existing numbers with a hyphen plus new number

Badge

Assuming that the number can be assumed based on the existing value minus 12344 + 10,000, this should work. Identify the number in the expression, calculate the new numerical value, replace the existing numbers with a hyphen plus new number

After bit of playing around, this is what i was after. Really appreciate your help.

Reply