Looking for a way to split this data out of a row and write it to another column with a header of Time

Quick summary: The data I have has a time stamp that I need but I don’t need the date that seems to be in the same row of the data. Example: The column name is AdminDateTime and in the column is this data 3/15/2021 10:19:00 AM as you see there is a date and a time in the same row, I would like to separate them and place the date or time in another column?

@jeff.shubzda - You can create a column using Add Column activity and then write the Split(1) to that column and Split(0) to the existing column…

image

Hope this helps…

1 Like

grafik

1 Like

I’m getting an error in the multiple assign


area?

@jeff.shubzda - Where is the array here??? We don’t need it.

I give up on this split thing I get errors all the time, gonna have to wait for a support contact. Now I get this Log Message: Index was outside the bounds of the array.

I have attached a copy of my application. as you can in the output the log message is working however when I try and add in another log message to split the data I get an error, no clue why? I add in another log message of arry_Date(1).ToString to get the time and I get a message of For Each Row: Object reference not set to an instance of an object. It doesn’t do that when I have the first log message.

Sorry wrong message - when I add in the 2nd log I get this message - Log Message: Index was outside the bounds of the array.

What was not working with alternate?

grafik

Well I’m not a pro at this and to this point I have confused myself on how this can be done. The way I tried it I needed to identify the column name then within that column name of PreAdminPainScoreTime I need to split that data out, which I though I was doing, but getting errors, your example makes sense but I’m not sure how to set up the flow. I started with a for each and when I use multiple assign is where I get errors. Thanks for the help on this I really wish we had support from UIpath like we did from another vendor.

can you show us your current for each part. maybe you can share some more details on the current implemented flow with us. Thanks

Also give a try on CDate(row("PreAdm…
in case of implementation has not much changed then give a try on
str_Date = CDate(str_DateTime).toShortDateString
str_time = CDate(str_DateTime).toString(“HH:mm:ss”) or toString(“hh:mm:ss tt”)

In case you need different formatted outputs let us know

1 Like

Thank you very much for the time spent on this, I know deliverable but haven’t grasped the process clearly. (goal- open the data, read the column, then split the data for time and date 08/03/2021 16:17:00 = str_FullTime.Split(" “c) - Then split this data ( str_Date = CDate(str_FullTime).ToShortDateString then write that data back into the new column PreAdminDate as just date and and write the data in the PreAdminPainScoreTime” column with just the str_Time = CDate(str_FullTime).toString(“HH:mm:ss”) . I assume you need to use multiple assign, but then I need to write that data back into sheet 2. I know I’m doing something wrong I can’t seem to figure it out that is on me. Honestly I would need a tutorial on this process which doesn’t exist. Like i said not a pro with this application.

just try a little be more forcus on short and clear messages.

We gave you an implementation suggestion lose to your screenshots

str_DateTime = row(“PreAdmin…”).toString.Trim
maybe str_DateTime is now str_FullTime, you can check it out in your imp

You will use for it multiple assignment acitvities or on Multple Assignment. So just start the modelling with this in your project.

In case of some concepts are unclear also do the relevant courses offered in UiPath Academy including the Debugging Course. So there is a help provided by the vendor as well.

When supporting us by clear messages and a traceable transparent actioning we can guide you and bring it to final state

This gives you an array of the two resulting items (the date, and the time) by splitting on the space. To get the actual values, you have to reference index (0) for the first item, and index (1) for the second item. Arrays are zero-based indexes. First item is index 0. If you’re trying to get the second item by referencing index (2) that’s why you’re getting an out of bounds error - the index (2) would be a THIRD item in the array.

str_FullTime.Split(" “c)(0) = date (first item in array)
str_FullTime.Split(" “c)(1) = time (second item in array)

Peter
here is the data i have in multiple assign

str_FullTime = row(“PreAdminPainScoreTime”).ToString
arr_FullDate = str_FullTime.Split(" "c)
str_Date = CDate(str_FullTime).ToShortDateString

I ran it and it threw this error? Multiple Assign: Can not assign ‘CDate(str_FullTime).ToShortDateString’ to ‘str_Date’.

Paul

Here is the multiple assign for your solution
str_FullTime = row(“PreAdminPainScoreTime”).ToString
arr_FullDate = str_FullTime.Split(" “c)
str_FullTime.Split(” “c)(0) = str_Date

in the output it split the data from 08/03/2021 16:06:00 to 08/03/2021
however when I add in the last part of the assign
str_FullTime.Split(" “c)(1) = time (second item in array)

Multiple Assign: Can not assign ‘str_Time’ to ‘str_FullTime.Split(" “c)(1)’.

It doesn’t have to be multiple statements. You can reference the index right at the end of the split, as I showed.

@jeff.shubzda
do one thing. If different approaches are suggested to you, do not mix up. Implement the one approach or the other. Also please model it as it is suggested

str_Fulltime.Split … on a left side from assign is incorrect ( a so called L-Value isse), but also was not mentioned by @prasath17 . Then it is better you model with single assign acitivites and check carefully the validation messages on acitivity top right corner

Is it possible to see how you set up the multiple assign, I posted how i did in both instance and got errors. I tired both ways.

@jeff.shubzda - Please check the below two…

Str_Date and Str_Time should be on the left hand side right??

image

Lot of options and solutions have been provided here and the post was created almost 27 days back and we are still discussing the same stuffs…:frowning:

I have also sent you a PM to setup a zoom to call to solve it…but you haven’t responded…

1 Like