Splitting a chunk of text, and assigning the result to a table

Splitting a chunk of text, and assigning the result to a table

  
Hi there,

I have a bunch of values that are comma diliminated.
Example of text in the variable:
123456,54
123455,44
123345,70

I want to split this text and assign each value to a different column in my table.

I have used the String_Split function succesfully, but having trouble saving the result it into a table.

Any help would be greatly appreciated.

Kind Regards
Heinrich
Hi Heinrich,

You just need to crate a variable of type Record of the entity you want to insert.
Then do a ForEach on the result of the string_split and fill the values in the record. Then use a Create<EntityName> action to insert it in the database.

There are also some Csv components in the forge that make it easier to read/fill the records.
Just note that some components that do things like that may not be yet prepared to work correctly with Platform 9 new data types. Say something if you try and find any problems with them.

Regards,
João Rosado
Hi João,

Thanks allot for all your help thusfar.
One quick question, when I make the variable a type of Record it requires a "Record Definition".
I tried to make this a structure but then I have a data mismatch when I try and assign the split result to the variable.

I also tried the screenactions by themselves and that somewhat worked but it only iterates through the number of files in the zip and not the number of lines in each csv file.

Is there another way of doing this? or will it be easier if I use CSV import or similiar?

Kind Regards



The String split returns a list of texts so instead of using it directly on the assing, drag the action to the flow and then on the assign you need to set the attributes one by one. 

As for the component that I said, yes it would that for you.
For example the CVSUtil component recieves a file as binary data and fills a RecordList variable with all the records filled. (I never used/tested any of them myself, just opened it a bit ago to see what it did).

Regards,
João Rosado
After splitting a string with String_Split, you can map it to a record like this:



You can directly access the output records from the String_Split by an index number, index 0 String_Split.List[0].Text.Value gives the 1st record of the output list (0 based array), more information can be found at the language reference here, under Indexer Declaration.

Hopes this help you mapping the output of the string_split to a record structure.

Kind regards,
Matthias