Problem Using Sub-string after Data Scrapping For Each Row

Hello guys,
Please help me why I can’t to substring my variable after using For Each Row Data Scrapping.
So I have a variable named ValidTo from the result of data scrapping. It contains date from SAP and I want to take the number of date, month, and year so I can compare it to make some logic for my project. I’m using substring to take the number of date, month, and year after using For Each Row, then I’m running the program to check the result after using substring and I found this error.

I also try using split first before, but it has same result. I checked my result of data scrapping and it works. The ValidTo variable contains the information I need but the format still 21.12.2019 (example).

I use assign and create new variable named Year then use ValidTo.ToString.Substring(6, 4). I check the data using message box after the substring but it doesn’t work. I read many application of substring and try it. The result is good but in that case they don’t use For Each Row first just using input dialog. Is my problem comes from using the For Each Row first or because I have a wrong programming process ?

I hope someone can help me to solve this problem because I’m newbie here and I’m waiting for the good news from you all. Thank you

1 Like

Hi, welcome to uipath community forum
Can you pls post the date sample that you are trying to do sub string

I already mention the date sample in my question.
Let me mention it again
So the example :

I want to take the information without the “.”
Thank you replying :pray::pray:

Lets say
Mainstr = 09.12.2019

create 3 different variables
DateVar string
MonthVar string
YearVar string
Now use assign activity
Datevar = Mainstr.split(“.”.tochararray)(0)
Use another assign
MonthVar = Mainstr.split(“.”.tochararray)(1)
Use one more assign activity
YearVar = Mainstr.split(“.”.tochararray)(2)

Use Split Function
//Assign //
date = Split(ValidTo,“.”)(0).ToString
Output = 09
month = Split(ValidTo,“.”)(1).ToString
Output = 12
year = Split(ValidTo,“.”)(2).ToString
Output = 2019

Cheers @Patrick_Ghozali

From your answer,
I try it and get an error like this
I already assign like your instruction

Absolutely I tried your instruction once before but got the same result like the upside image again

Show your assign value

Ohh thank you" fot the reply I got it now
Thank you so much for the answer

This work too. Thank you so much for replying !! :pray: :pray:

1 Like

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