Assignment 2 Generate Yearly Report - Extract TaxID

Hi all,

I am facing the below issue while trying to extract the TaxId .

I perform a GetText to retrive the VendorInformation.

VendorInformation is variable of generictype
VendorinformationArray is string.

VendorInformationArray=VendorInformation.Split(Environment.NewLine.ToArray,StringSplitOptions.RemoveEmptyEntries)

out_TaxID = VendorInformationArray(0).Split(":"c)(1).Substring(1)
I get this error “Assign: Index was outside the bounds of the array.”

Could someone please help ?

Thanks,
S

Hi @Sharmi_thangam_malat,

In your output panel, it is clear that the first line of your captured text block is “Vendor Information”. So, when you split this text with new line, the first element in the array will be “Vendor Information”. Then you try to split this text with a delimiter “:”, and capture the array element 1, it will return an error because that index doesn’t exist.
You can either solve this issue by start splitting “VendorinformationArray” from the first element, that is,
out_TaxID = VendorInformationArray(1).Split(":"c)(1).Substring(1) or in the get text activity, select the text block excluding the line “Vendor Information”. :slightly_smiling_face:

Warm regards,
Nimin

Thanks ! .Got my mistake … Your solution helped resolve the issue.

1 Like

Hi @Sharmi_thangam_malat,

If you are using “.Substring(1)” to remove the whitespace in your split string, you can otherwise use “trim” method, like out_TaxID = VendorInformationArray(0).Split(":"c)(1).Trim

Warm regards,
Nimin

1 Like

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