cancel
Showing results for 
Search instead for 
Did you mean: 

Find start date based on Week number

KrishnaElapavul
Level 6
Hi ,
I have requirement to calculate start date of week   against the Week number .
Input would be Week number ( 14, 17...)
Output should be  Start date of respective week
For example : 
in Year 2021 for week number 14 , Start date of week is 05-04-2021
in Year 2021 for week number 17 , Start date of week is 26-04-2021
I have an option to calculate it in Excel and read the same . But I would like a suggestion to get in Blue prism action either by code stage with out using Excel VBO
Thanks
Krishna

------------------------------
Krishna Elapavuluri
TEchnology Consultant
DXC.technology
Asia/Kolkata
------------------------------
1 BEST ANSWER

Helpful Answers

Okay attaching the release file here. Try it out.

------------------------------
Thanks & Regards,
Tejaskumar Darji
------------------------------

View answer in original post

10 REPLIES 10

david.l.morris
Level 15
This works: Calculate date from week number

I realized it might take longer for me to explain the steps to create an object than for me to just upload it. So here's a quick object I threw together with the code from that StackOverflow answer. You'll want to test it out. I make no guarantees. 😃

---
EDIT: I'm the worst. I renamed the code stage right before export before. See my next response for a slightly updated object. Oops! 😃
---


The attached object was created in 6.8. If you have a version earlier than 6.6, it's gonna get imported all wonky. It should still work and you can drag the stages around to fix it.

------------------------------
Dave Morris
Cano Ai
Atlanta, GA
------------------------------

Dave Morris, 3Ci at Southern Company

Same object but the code stage is renamed to remove the compile error.

------------------------------
Dave Morris
Cano Ai
Atlanta, GA
------------------------------

Dave Morris, 3Ci at Southern Company

Hi Krishna,

Please also find the native Blue Prism "No Code" solution for this problem.

Only dependency --> Utility-Date and Time Manipulation (Get it from DX simply)

14014.png
14015.png

XML file attached. Hope it helps.






------------------------------
Thanks & Regards,
Tejaskumar Darji
------------------------------

P.S. Attaching XML since unable to upload .bpprocess extension file.

------------------------------
Thanks & Regards,
Tejaskumar Darji
------------------------------

Hi Tejaskumar,

I'm intrigued to try that solution. But I have a couple of questions.
  1. Would it support previous years or only the current year? I imagine Krishna may only need it to work for the current year, but it'd be cool if it worked for previous years as well. Part of the reason I grabbed custom C# code is that it was designed specifically to handle difficult years.
  2. My Utility - Date and Time Manipulation VBO doesn't have an action called 'GetWeekDay', and I'm using 6.10.1. Are you sure that isn't a custom action that your organization added? In any case, I would think it's simple code, but I'm not sure what output it's going for. The Utility - Date and Time Manipulation VBO on the DX also doesn't have that action.


------------------------------
Dave Morris
Cano Ai
Atlanta, GA
------------------------------

Dave Morris, 3Ci at Southern Company

Hello Dave and Krishna,

Thank you Dave for providing valuable suggestions on 1. To extend the logic to get input year as well and 2.Dependency on Utility.

Dave is right that Utility - Date and Time Manipulation VBO from DX doesn't have an action called 'GetWeekDay' (I'm not sure how I got it though)

To eliminate dependency from that Utility I've updated the solution and now not using that Utility anymore.

Also added Input parameter I_Year to be passed as input, and in case no input year passed solution will take the current year by default.

Please find the updated XML file.

And yes it is working for past years as well.

Feel free to provide feedback and suggestions.


14020.png

------------------------------
Thanks & Regards,
Tejaskumar Darji
------------------------------

Hi Tejas,

Thanks for your solution, 
Sorry for late reply ,
When i tried to  import the xml file , i am getting the following error 
can you throw light on this error .

'dd-MM-yyyy' is an unexpected token. Expecting white space. Line 109, position 45.
But in xml file  above format is in "" 
<calculation expression="FormatDate([Date],"dd-MM-yyyy")" stage="O_Start Date Of Week"/>

I am using BP 6.7

Thanks
Krishna

------------------------------
Krishna Elapavuluri
TEchnology Consultant
DXC.technology
Asia/Kolkata
------------------------------

Okay attaching the release file here. Try it out.

------------------------------
Thanks & Regards,
Tejaskumar Darji
------------------------------

Thanks Tejas,
Now I am able to use the Process. 
However I have made few changes  as present process still looking for Utility - Date and Time Manipulation VBO

Thanks
Krishna



------------------------------
Krishna Elapavuluri
TEchnology Consultant
DXC.technology
Asia/Kolkata
------------------------------