HELP! Trying to only type the "departure date" out of a date span (1/2/2022 - 1/15/2022)

Hello friends,

I’m new to UI Path and need a bit of help. I have an Excel sheet that I’m using to plan out different flights for trips. I’m looking to “type into” the departure date and then the arrival date, however in the Excel sheet the “Travel Dates” are listed in a span (1/2/2022 - 1/15/2022). Without making changes to the Excel sheet is there anyway I could have the robot differentiate the departure and Arrival dates?

Thank you!

Several solutions… lets go for a quicky…

Assumption: you have a string TravelDates containing “1/2/2022 - 1/15/2022” which you read from your source excel already.

new variables:
Assign DepartureDate = TravelDates.split("-“c).first.trim → “1/2/2022”
Assign ReturnDate = TravelDates.split(”-"c).last.trim → “1/15/2022”

This splits the Traveldate into segments based on the - character, picks either the first or the last value, and trims it of surrounding spaces.

Now type into either one of the new vaiables containing only the departure date or the return date, wherever you please.

You can also play around with regex solutions, but the above is simpler to learn and understand at first.

Thank you so much for that Jeroen_van_Loon! I can’t believe the forum worked! Now if it’s reading 5 different locations and dates would you suggest doing a new variable for each one or is there a better option?

Example
1/2/2022 - 1/8/2022
1/5/2022 - 1/15/2022
2/12/2022 - 3/1/2022
5/25/2022 - 6/1/2022
6/2/2022 - 6/10/2022

Yes yes… forums sometimes work… (Little secret, there’s actual people behind it ;))

As for your question, it depends a bit on the structure of your list.
If it is an actual list or datatable you can create a for-each loop to iterate through all of these items.
If it is one string that contains your data you need to apply more string manipulation, and face a couple of new challenges. Structured data is a main requirement of RPA.

As for you being new to UiPath (we’ve all been there), I do feel the need to point out that most of this is covered quite well in the UiPath Academy trainings. Takes a bit of time to go through it, but definately worth it to get a grip on the basics like this. Reading excel and processing data through loops is definately covered there.

Wow thank you so much @Jeroen_van_Loon. You’ve been such a big help, I cant wait until I get good enough to help someone else out!