Generic value to Array

Hi All!
Good Day!

I Have a problem in Generic value,
I reading a Excel which has Time Column,
There is an error occur at the time while running,
string converter cannot convert from system.double when i am used read cell activity. So, I changed the data type as Generic and for some other time values the index was outofbound of the array error occurs,

Here i am splitting the time by Hours , Minutes and seconds?

can someone Pls help me with this?

Thanks In Advance:)

Hi @soundarya_A1

  • If you need to convert from double to string. to do that follow as below:
    yourdouble.tostring or covert.tostring(123453)
  • This error occurs due to more element in the specified array size. i.e. you have an array of 5 items. (array {1,2,3,4,5}) if you try to get the item from index 10 (array(10)) you will get this error as there is actually only 5 indexes (the max being 4 as arrays start at 0).

Hope it helps you!

@soundarya_A1 ,

The double datatype value you are getting for date is called OADate.

Use this logic to convert it to DateTime string.

DateTime.FromOADate(Cdbl(yourstringdatevariable)).ToString("dd/MM/yyyy")

Thanks,
Ashok :slightly_smiling_face:

Hi @soundarya_A1

Input:
image

Read Cell properties

Use below syntax in Assign:

Assign-> ArrVal = Output.Split(":"c)

Assign-> Hours = ArrVal(0)

Assign-> Minutes = ArrVal(1)

Assign-> Seconds = ArrVal(2)

Message box: "Time: "+Output+vbCrLf+"Hours: "+Hours+vbCrLf+"Minutes: "+Minutes+vbCrLf+"Seconds: "+Seconds

Variable DataTypes:

Output:

Regards

1 Like

Hi,
Thanks for helping
I am working with the same flow, But in the read cell there is an error occurred as string converter cannot convert from system.double, so i changed that output as generic value. but i am having a error as index was outofbound of the array error.

can you help me with this?

Hi @soundarya_A1

Can you share the screenshot of Input excel.

Regards

![Screenshot 2024-03-05 141701|682x427]
*

Hi @soundarya_A1

If possible could you share this excel.
Regards

Hi @soundarya_A1 ,

image

image
image
Here i attached the image flow, Based on your condition , I hope this is help to you .
If any thing i understand wrong . can you explain again what do you what ?

Regards,
Darwin

Hi @soundarya_A1

Check the below workflow. Hope this meets your requirement.

Sequence23.xaml (13.1 KB)

If you have any queries, I’m happy to help.

Regards

Hi,

Thankyou so much for the Help

And I also need to split the session as well

Regards

Hi @soundarya_A1

Could you be more specific. Are you telling about AM/PM like that. Please specify.

Regards

Can you please upload excel file here

Yes exactly, also i am using a read cell activity to fetch the matched county’s time.

Hi @soundarya_A1

Do you need output Like for ADAMS Hours is 8 minutes is 30 and seconds is 00 and session is AM.

Regards

Hi @soundarya_A1

Check the below workflow file. Hope it meets your requirement
Sequence23.xaml (13.8 KB)

Happy to help if you have any queries.

Regards

@vrdabberu

Yes, while using read cell activity for some inputs I faced an error string converter cannot convert from system.double , so I changed the output of read cell as Generic value, it worked fine, but some other inputs i am facing index was out-of-bounds of the array error.

Hi @soundarya_A1

Rather than using Read Cell Value activity since you have multiple rows I read the data into datatable and iterated through it to get the values out.

Download and check he workflow once as it’s easy to understand too. Just Change the filepath of Read Range Workbook, and run the flow you will understand.

Regards

Hi @vrdabberu
I need to use the read cell activity to find the time for particular county to proceed a further process.

Hi @soundarya_A1

Check the below workflow:
Sequence23.xaml (12.4 KB)

Regards