cancel
Showing results for 
Search instead for 
Did you mean: 

Six-digit number, store as date, compare to masked data

john.hammond
Level 6
Apologies for the somewhat confusing title - I'll try to break it down a bit here!

So, this object that I'm currently working on receives data from an API call. A date would be in the format of 130921, which is stored as a number in a collection. The object then writes this into a web form, which gets understood and converted to 13 September 2021. This all works absolutely fine as it should do.

However, for good practice purposes, I would like to add a read stage at the end of this particular page on the object to ensure that the date has been written successfully. 

The first problem is how do I get Blue Prism to recognise the number '130921' as a date? I currently receive the message 'cannot be interpreted as date' during a calc stage with the expression ToDate("130921") (obviously this will reflect the location this value is stored in).

Once I've managed that, how do I go about amending the masking for this date in order to turn (presumably) 13/09/21 to 13 September 2021 in order to check that the read value matches the initial input value?

Hopefully that all makes sense!

------------------------------
John Hammond
------------------------------
1 BEST ANSWER

Best Answers

VedSengupta
Level 6
Hello John,
First Type Case the number to Text and add "." to format like 13.09.2021

Text can be type casted into Date or Date Time with Format Functions available in Calculation Stages.

------------------------------
------------------------------
Best Regards,
Ved Sengupta
RPA Developer
Deloitte India (Offices of the US)
Bangalore | INDIA
------------------------------
------------------------------
------------------------------ Best Regards, Ved Sengupta RPA Developer Deloitte India (Offices of the US) Bangalore | INDIA *If you find this post helpful mark it as best answer* ------------------------------

View answer in original post

3 REPLIES 3

VedSengupta
Level 6
Hello John,
First Type Case the number to Text and add "." to format like 13.09.2021

Text can be type casted into Date or Date Time with Format Functions available in Calculation Stages.

------------------------------
------------------------------
Best Regards,
Ved Sengupta
RPA Developer
Deloitte India (Offices of the US)
Bangalore | INDIA
------------------------------
------------------------------
------------------------------ Best Regards, Ved Sengupta RPA Developer Deloitte India (Offices of the US) Bangalore | INDIA *If you find this post helpful mark it as best answer* ------------------------------

Here is the solution. It uses the same concept as Ved mentioned using Date transformations.

Here I'm assuming that your input is always going to be in DDMMYYYY format as plain text.

It works fine. Take a look.

23716.png

------------------------------
Thanks & Regards,
Tejaskumar Darji
Sr. RPA Consultant-Automation Developer
------------------------------

Thank you Ved (and Tejaskumar) - I placed all of that in a Multicalc and it worked a treat.
For anyone who comes afterwards, this is what I entered:

23717.png

------------------------------
John Hammond
------------------------------