Map Input file value to variable date

I have an Input.xlsx file being read during Get Transactions. The input file is basically the 7 report names and some parameters being brought in during Process Transactions. Some of these reports get run from Today through End of Month, and others are Today through End of Quarter.

I know I can split the reports into different workflows and call them using IF Transaction = (matching number/range) and use the arguments defined earlier in the process, but I expect there’s a cleaner way to do it by using the same Input file and mapping the value to a defined variable.

IE Input File Column EndDate
Report 1: EOM
Report 2: EOQ

EOM maps to the EOM variable that’s been assigned, and EOQ maps to the EOQ variable that’s been assigned.

Hi @rridlen,

I don’t know what are you exactly saying!. But I just ask you a simple question.
Do you want to convert a cell value into DataTime variable?
Like below !
image

Basically I want to assign the value from Column A in your example to a defined DateTime variable in the workflow if possible.

Hi @rridlen,

First filter the DataTable by Date. Check if there is only one record for matching exact date and use Switch Activity to invoke different workflow.

Thanks.

If I understand correctly, you could use Dictionary(of String, DateTime), where you can define what process has which date. But still i don’t see enough information to help you.

Maybe you could describe it with more details ?

1 Like

Sorry, hopefully this helps. The current Process workflow looks like this:


I’d like to get rid of the IF statements to make it easier to track/maintain. Originally there were multiple steps unique to each transaction inside the IF → Then workflows. I’ve managed to remove all of them except for the date parameters.

Transaction 1 uses the following variables:

Today = DateTime.Today.ToShortDateString
Month = Date.ParseExact(now.AddMonths(1).ToString(“MM/01/yyyy”),“MM/dd/yyyy”,nothing).AddDays(-1).ToString(“MM/dd/yy”)

image

Transactions 2-7 could now be consolidated to 1 IF statement since the report formats have been moved to an Inputs.xlsx file. They all use the same date logic. Start Date = Today & End Date = End of Quarter.

dateCurrentQuarterDate = DateTime.Now.AddMonths(-1)
intCurrentQuarterNumber = Convert.ToInt16((dateCurrentQuarterDate.Month - 1)/3+1)
CurrentQuarterStartDate = out_CurrentQuarterEndDate
out_CurrentQuarterEndDate = CurrentQuarterStartDate.AddMonths(3).AddDays(-1)

QuarterEnd = in_QuarterEndDate.ToString(“MM/dd/yyyy”)

image

I wanted to know if I could get rid of the IF statements completely and map a value from Inputs.xlsx to fill in the To Date based on if the report runs to the end of the month, or the end of the quarter.

IE Transaction 1:
From: Today
To: EOM

All other transactions:
From Today:
To: EOQ

image

Thanks,

Still i’m not sure if I catch up :wink: but, here are some thoughs maybe one of them will fit:

Instead of IF i would use Switch with condition of EndDate, so you could have only 2 cases,
I’m not sure if for transaction 2-7 process looks simmilar

Or in case all transactions are doing the same but for different dates, i would create one Workflow with at least 2 args: StartDate and EndDate, and then for those generate reports.

But still i’m not understand if for each of transaction robot is doing different tasks or simmilar.

Cheers :smile:

P.S.

I have one process where robot is doing almost same thing for different props, in that case i’m using case and in arguments just passing different dates and booleans.

Everything is the same except for the To Date at this point. Transaction 1 uses Month and Transactions 2-7 use QuarterEnd.

I’ll take a look at switch.

Thank you.