Date need to match as current date -1 and +1

Hello Community,

I got an process which will be host terminal.

I need to check the data in host using input date from user.

Requirement : as per user input date we need to check in host terminal before -1 date and current date and +1 date for each input.

can you please suggest the flow how to make it work.

Ex : 31/102022 user need to check 30/10/2022,31/10/2022,1/11/2022

Regards,
Chaitanya

Hello @chaitanyaKumar

You can use modify Date activity to do the date calculations.

Thanks

Hi @Rahul_Unnikrishnan

You try using a flowchart. 1st sequence add steps to get date from the terminal, Assign it to string variable for eg let it be “str_terminaldate”. Add 3 flow decision to check the dates and add steps to be performed accordingly. Condition for flow decision is as below-

Current Date Condition - convert.toDatetime(str_terminaldate).tostring(“dd/MM/yyyy”) = now.tostring(“dd/MM/yyyy)”
-1 Date Condition - convert.toDatetime(str_terminaldate).tostring(“dd/MM/yyyy”) = now.AddDays(-1).tostring(“dd/MM/yyyy)”
+1 Date Condition - convert.toDatetime(str_terminaldate).tostring(“dd/MM/yyyy”) = now.AddDays(+1).tostring(“dd/MM/yyyy)”

Please try this and let us know if this works.

Hi,

In this case, we can use Switch activity as the following.

 (DateTime.ParseExact(strInputDate,"d/M/yyyy",System.Globalization.CultureInfo.InvariantCulture)-Today).Days

Main.xaml (6.4 KB)

Note: Please check input string is valid datetime style in advance, if necessary.

Regards,

Hi Yoichi,

it worked my workflow will be like according to the -1 the condition also need to ne build for next steps.

like if -1 date the flow need to continue based on condition. is it possible by using switch scenario.

Regards,
Chaitanya

HI,

In general, it’s possible. However it depends on requirement whether Switch is better solution or not.
For example, if this process in a loop, we can set Break or Continue activity to skip the following process in 0,1 and default case. But we can write it using If activity, too.

Regards,

Hi Yoichi,

yes this process will continue as loop, like if -1 data not having value it need to check for 0 value. if 0 value also not having data it need to check in +1 date.

can you guide me such flow.

Regards,
Chaitanya.

Hi,

yes this process will continue as loop, like if -1 data not having value it need to check for 0 value. if 0 value also not having data it need to check in +1 date.

I didn’t understand your requirement 100%, however the following might help you.

Sample20221031-1v2.zip (2.9 KB)

Regards,

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.