Index out of bounds in array on the second transaction in Generate Yearly Income Assignment

In this workflow, I’m extracting the vendor information for the Advanced Assignment 2: Generate Yearly Income. I already have all the W14 workitems’ WIID uploaded in a queue in orchestrator and grabbing them for this.

In the Get Text Activity, I get the Vendor Information text block. Then, I split the string to just get the TaxID. However it breaks there.

The output panel:

Can someone help me understand more about what I’m doing wrong with the Assign Out_TaxID activity? Or give me ideas on how to fix this? Thank you!

@AndreMercier4
What’s the full value of the right-hand side of the Assign out_TaxID activity there?

Fine
to get the tax id
we can mention like
out_TaxId = Split(ClientInfo.Split(Environment.Newline.ToArray())(0).ToString,“:”)(1).ToString.Trim

hope this would work for sure

Cheers @AndreMercier4

Its:

clientInfo.Split({"TaxID: ", "Name: "}, StringSplitOptions.None)(1).ToString

It seems to work but it seems like I’m missing a character or two. The second time around, it only grabbed the numbers and not the two letters in front of the TaxID number. Example:

0892123
where it should be
RO892123

Thank you for your response :smiley:

1 Like

aaah i thought there is some space between : of two words
Fine
then we can mention like
out_TaxId = Split(ClientInfo.Split(Environment.Newline.ToArray())(0).ToString," ")(1).ToString.Trim

hope this would work
Cheers @AndreMercier4

2 Likes

In the one time that the program managed to reach getting the second taxid (selectors decide to fail whenever they feel like it), it does the same thing where it only managed to grab the numbers. If this helps, earlier today I had to debug my out_TaxID because it had unwanted “\r\n” at the of end of it. Thus, the reason why I have a second assign to replace those with empty “”. I tried also with ": " but that didn’t work either.

1 Like

Kindly check with the selector and replace the dynamic part of the attribute value with wildcards symbols *
—so that it will be stable enough to get the same set region of values
Cheers @AndreMercier4

1 Like

I managed to pass the assignment not so long ago and I looked into their detailed guideline. The way they have it is similar to yours. They did like this (using clientInfo to represent the Get Text output):

clientInfo.Split(Environment.NewLine.ToCharArray)(0).Substring("TaxID: ".Length)

I may try this later. Will also check about the selector. I had 10 items and it broke on the 6th or 7th one.

Thank you again, @Palaniyappan ! :slight_smile:

1 Like

No worries
Cheers @AndreMercier4