cancel
Showing results for 
Search instead for 
Did you mean: 

Repeater split comma seperated field into multiple fields

Former Member
0 Kudos

I have an sql statement which get some rows with fields. In the last field LINE all information is ; seperated so ( 318.0012, 3, test, 4 etc)

What a want to do is split these values and put them into fields.

I know you can do string list to xml parser, but that is not the solution i am looking for.

SQL_Read_Orders_from_Kardex.Results{/Rowsets/Rowset/Row}

Is this row there is the field LINE.

Is it possible to let the repeater split the values? And assign these values to a new xml output document?

Accepted Solutions (0)

Answers (3)

Answers (3)

jcgood25
Active Contributor
0 Kudos

Have you considered the StringListToXML action in your repeater to 'split' the comma separated element in the Repeater into an xml set?

Easy test - paste the sample string into a local and link it into this block and look at its output.

You'll still have to do all of the IllumDoc building efforts, but it should avoid you having to loop through a comma separated string and chopping it apart the hard way.

agentry_src
Active Contributor
0 Kudos

That's a much better method. Forgot about that option.

Thanks,

Mike

Former Member
0 Kudos

Jeremy, Mike,

I also forgot about that. Sometimes it's useful to run through all the available functions and actions again to refresh what MII offers...

Michael

Former Member
0 Kudos

Sounds as if you are looking for something similar to a "split" function like split(string, ",").

Like Mike wrote there will be no single repeater solution, but you will have to build some sequences using a repeater and MII string functions to extract the CSV information from you field LINE.

You may also want to build a transaction which gets the LINE as input and returns a MII XML with the single values in rows as output. In the caller transaction you can then use a repeater to walk through the rows.

Michael

agentry_src
Active Contributor
0 Kudos

To give you more details on one method of parsing, try the following:

When doing the LINE parsing, use a While Loop or For Next Loop instead of a repeater. Assign LINE to a local property. Extract a data value and assign the rest of LINE to that local property and then loop back to get the next data value. Put a Conditional in to "break" the loop when there are no more delimiters left, and make sure you grab the last data value after the Conditional.

And I agree with what Michael said. It probably is a good idea to make it a separate transaction.

Good luck,

Mike

agentry_src
Active Contributor
0 Kudos

I would first look to doing your parsing in the SQL Statement. That will be faster than parsing it in MII.

However, should you still wish to do it in MII, there is a string function which can be used to identify the first location of your delimiter: stringindexof. Then you can use some combination of string functions to extract the data you desire. If the lengths of each data object in the LINE field are fixed, you could extract all the data in a single pass instead of using a repeater and conditional process flow. There are probably other methods that could also be used.

Good luck,

Mike