How to Iterate Text value ?

How to Iterate Text value ?

  

Hi All,

I have to get all characters of text="1234233" in List .. In short i have to convert text value to list of values.

Is it possible with single function ?

Thanks & Regards

DM Singh

Hi DM,

you can check out the length of the string and then make a loop with incremental index values and append it to list.

you are done :)

Debasis Sahoo wrote:

Hi DM,

you can check out the length of the string and then make a loop with incremental index values and append it to list.

you are done :)


Can you provide me an OML file .. it will be helpful for me

Solution

Hello DM,

As I understand it, you want to transform the string "123423" in a list of values, like this:

List of values:
value 1 = 1
value 2 = 2
value 3 = 3
value 4 = 4
value 5 = 2
value 6 = 3

A possible way to do that is using the system 'ListAppend' action combined with the 'SubStr' function (here). First you need to create the variable that will be your List of Values. Then, you receive a string with 6 characters and you want to separate them one by one (using the 'SubStr' function), storing each one in the List of values using the 'ListAppend' action. You can encapsulate all this "flow" in a user action and call it whenever you need it.

Best Regards



Solution

Debasis Sahoo wrote:

Hi DM,

you can check out the length of the string and then make a loop with incremental index values and append it to list.

you are done :)

Hi Debasis, 

Idea is good, but how you will read each character before append it to the list.

Sachin


Hi All,

Thanks for the reply.

So the final solution is to read each char using substring function ... Am i right ?

Thanks Paulo 

Hi,

You can also use this extension. https://www.outsystems.com/forge/component/2524/text-v2/

Regards,

Marcelo

Sachin Mahawar wrote:

Debasis Sahoo wrote:

Hi DM,

you can check out the length of the string and then make a loop with incremental index values and append it to list.

you are done :)

Hi Debasis, 

Idea is good, but how you will read each character before append it to the list.

Sachin


Hi Sachin,

you have got the length of the string, make a counter variable, loop until the length of the string is reached. inside the loop use the substr() function and pass on the value of the current loop index and 1 to get the single character every time. Now append it to list. That' so simple :)


Thanks Debasis, Now I got it. 

I know it was so simple but even I wasn't recalling it.

Thanks

Sachin

Sachin Mahawar wrote:

Thanks Debasis, Now I got it. 

I know it was so simple but even I wasn't recalling it.

Thanks

Sachin

No worries .. It happens with me as well :)