How to write a split function for items joined using the join function

Good day, everyone.

I need help figuring out how to create a split function that divides the items I read using the Read Column activity.

image

image

I had joined the values together using the join, but I must utilize each value independently.

Kindly advice on how I can accomplish that milestone.
Thank you in advance.

Regards,
Klaus

1 Like

You don’t need to split then join. That makes no sense.

Just iterate through iguserName with For Each. Or reference specific values by array index ie iguserName(0).ToString - which will get you the first username.

I want to use for each but when I use it I get System.Object as the value returned.

image

But when I try to index I get the desired value so how can I refactor my code such that it works seamlessly.

1 Like

Hey @Kakooza-Allan-Klaus

Are you using .ToString at the end ?

Thanks
#nK

When you use .ToString at the end you still get the same value of System.Object

1 Like

image

What’s the type of iGusername ?

image

1 Like

Also could you please show the values in it and where and how are you using it?

igUserName isn’t a datatable. Use For Each, nor For Each Row.

Assuming your For Each uses item, then you’d use item.ToString to get the text value.

But why is iguserName IEnumerable(of object) instead of just of string?

The correct way to do this is to have iguserName be System.String (which means array of string) and then just For Each through it. Then you don’t even need the .ToString

Because am using the Read Column which stores it as a IEnumerable

1 Like

So just use For Each (not For Each Row) and then item.ToString

1 Like

I did use the For each just changed item to row
But when I do that I just get the last item in the object

1 Like

That {0} you have in your URL string and reference to igUsername is not how you do this. Again, you have to use row.ToString (or item.ToString or whatever variable you designate in your for each).

image

Or…

String.Format(“http://somesite.com/{0}”,item.ToString)

In a For Each, you don’t reference the thing you’re looping through. You reference the variable shown in the For Each (ie item, row, whatever you named it)

1 Like

@Kakooza-Allan-Klaus This should help.

1 Like

image

I already did that @postwick but still getting the last item only

You can’t be. There is no conceivable way a For Each would do that.

The code the way you have it will just quickly iterate through the four usernames and navigate the browser, without doing anything else. It’s probably iterating through them, but so fast you only see the browser land on the last user.

Comment out Navigate To and put in a Log Message with item.ToString and you’ll see it.

1 Like

Thanks alot @postwick
Your very right

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.