cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper III
Helper III

convert excel online date field

I would like, daily,  to delete all rows older than 90 days from an excel online file .

First i have to convert the excel online date from integer to a date string to define if it is 90 days old.

I made a flow to get the table data every day and initialize a string variable. 

flow excel.PNG

 

 

 

 

 

 

Next step is to convert the ReserveringsDatum (integer) :

 

Yvonzim_0-1603276301267.png

Set Variable: 

addDays('1899-12-30',int(body('List_rows_present_in_a_table')?['DatumReservering']),'yyyy-MM-dd')

 

Then i get this error:

Unable to process template language expressions in action 'Set_variable' inputs at line '1' and column '2869': 'The template language function 'int' was invoked with a parameter that is not valid. The value cannot be converted to the target type.'.

 

Tried to change the initialize variable to Integer - object etc..no luck.

 

Where am i going wrong?

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Hello @Yvonzim 

I've realized you are using a wrong expression, since you have to refer to the current item in the apply to each action. You should use the following expression:

addDays('1899-12-30',int(items('Apply_to_each_3')?['DatumReservering']),'yyyy-MM-dd')

Hope it helps!

Ferran

Did I answer your question? Please consider to mark my post as a solution to help others.
Proud to be a Flownaut!

View solution in original post

5 REPLIES 5
Highlighted
Super User II
Super User II

Hello @Yvonzim 

Could you check that all the excel rows have a value in the column called "DatumReservering"? Maybe it's empty and it can't be converted to an integer value.

Hope it helps!

Ferran

Did I answer your question? Please consider to mark my post as a solution to help others.
Proud to be a Flownaut!
Highlighted

@fchopo Tnx for the tip, but unfortunately no empty fields.

Highlighted

Hello @Yvonzim 

I've realized you are using a wrong expression, since you have to refer to the current item in the apply to each action. You should use the following expression:

addDays('1899-12-30',int(items('Apply_to_each_3')?['DatumReservering']),'yyyy-MM-dd')

Hope it helps!

Ferran

Did I answer your question? Please consider to mark my post as a solution to help others.
Proud to be a Flownaut!

View solution in original post

Highlighted

@fchopo tried this, other error 🙂

 

Unable to process template language expressions in action 'Set_variable' inputs at line '1' and column '2870': 'The template language function 'addDays' expects its second parameter to be an integer. The provided value is of type 'String'.

 

Changed "initialize variable" from string to integer, both times same error.

Screenshot Excel:

Yvonzim_0-1603283064898.png

 

Highlighted

@fchopo 

 

UPDATE: it works!

 

don't know what i did different but variable = string

and your code

addDays('1899-12-30',int(items('Apply_to_each_3')?['DatumReservering']),'yyyy-MM-dd')

 

Thanks a lot!

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Top Solution Authors
Top Kudoed Authors
Users online (11,076)