Date Collection variable


Badge +8

Hi,

Here is my scenaio:

I am querying list and collecting "Date initiated" column values into a collection variable. I now would like to iterate through each date initiated value and calculate "Number of days in Approval" which is a difference between (current date and Date initiated). I then update the number of days in approval field in the list item.

Sounds simple but with dates involved in the collection, I am not able to achieve this.

  • I iterate through Date initiated collection and store each date in "var_datestring" String variable. 
  • I then use convert value to use "datediffdays" function to calculate the difference between var_datestring and current date.

I schedule this workflow once a day and the workflow ends with the error below

205637_pastedImage_1.png

Collection Operation Configuration:

205638_pastedImage_2.png

Convert value action configuration.

205639_pastedImage_3.png

Error received:

205666_pastedImage_1.png


5 replies

Badge +16

I think you should use convert value first time round to convert your string variable into a date variable.

Then use date difference to calculate difference between the Current Date and the date variable in the above step.

Badge +8

Hi Cassy,

Can you please outline the steps ? I am not sure how "time round" string variable? I tried to use date value as is but then Collection operation does not work with date values.

Thank you,

Badge +16

No I mean:

step 1: use convert value action to convert your collection item from string into date format

steo 2: use date difference with value from step 1 and current date

Badge +8

Hi Cassy,

It wasn't working. Can you please give clear steps that worked for you.

Badge +16

I have a collection of date fields vCollDateInitiated.

In my for each, I pull a text value vTextDateInitiated (the same as your var_datestring)

I then use (inside the for each) the convert value action as follows:

this converts my text date into a date variable called vDateDateIntiated

Then I use date diff like this:

fn-DateDiffDays({Common:CurrentDate},{WorkflowVariable:vDateDateInitiated})

Reply