cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

add missing date

Hi,

I created a Flow with a Flic button. If I press the button, a new row with the current date, time and coordinates is added to an Excel table (Excel online OneDrive). This works already.

But if I forgot to press the button, the next timestamp is added directly below the last row. So these forgotten days are not displayed in the table.

 

current table.jpg

 

Is there a way to always compare the last row of the Excel table with the current date and automatically add the missing days before the next timestamp is added?

It should look like this:

 

that would be great.jpg

 

It would be really great if someone could help me with that.

 

Best regards

Ray

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Solution Sage
Solution Sage

Re: add missing date

Hi @RayRay ,

First of all, the datetime string must match ISO 8601 format.

So you need set the date like yyyy-MM-dd or yyyy/MM/dd.

Second you need set the format of the Date as text.

Capture4.PNG

Then I have made a flow for your scenario, please check it for a reference.

The expression in compose is to get the last rowlast(body('List_rows_present_in_a_table')?['value']) 

The expression in compose 2 is to get the value of Date: outputs('Compose')?['Date']

The expression in compose 3 is to get the value of Date in this year: dayOfYear(outputs('Compose_2'))

The expression in compose 4 is to get the value of today in this year: dayOfYear(utcNow())

The expression in compose 5 is to compare the date and today: sub(outputs('Compose_4'),outputs('Compose_3'))

The expression in 'Add a row into a table' is: addDays(outputs('Compose_2'),variables('days'),'yyyy-MM-dd')

Capture5.PNGCapture6.PNGCapture7.PNG

Capture8.PNG

 

By the way, there is a simple method to avoid the missing.

You can use the 'Recurrence' trigger here, then set it run one times every day.

Capture9.PNG

Best Regards,

Community Support Team _ Zhongys

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

1 REPLY 1
Highlighted
Solution Sage
Solution Sage

Re: add missing date

Hi @RayRay ,

First of all, the datetime string must match ISO 8601 format.

So you need set the date like yyyy-MM-dd or yyyy/MM/dd.

Second you need set the format of the Date as text.

Capture4.PNG

Then I have made a flow for your scenario, please check it for a reference.

The expression in compose is to get the last rowlast(body('List_rows_present_in_a_table')?['value']) 

The expression in compose 2 is to get the value of Date: outputs('Compose')?['Date']

The expression in compose 3 is to get the value of Date in this year: dayOfYear(outputs('Compose_2'))

The expression in compose 4 is to get the value of today in this year: dayOfYear(utcNow())

The expression in compose 5 is to compare the date and today: sub(outputs('Compose_4'),outputs('Compose_3'))

The expression in 'Add a row into a table' is: addDays(outputs('Compose_2'),variables('days'),'yyyy-MM-dd')

Capture5.PNGCapture6.PNGCapture7.PNG

Capture8.PNG

 

By the way, there is a simple method to avoid the missing.

You can use the 'Recurrence' trigger here, then set it run one times every day.

Capture9.PNG

Best Regards,

Community Support Team _ Zhongys

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

Helpful resources

Announcements
secondImage

August 2020 CYST Winners!

Check out the winners of the recent 'Can You Solve These?' community challenge!

thirdImage

Experience what's new for Power Automate

Join us for an in-depth look at the new Power Automate features and capabilities at the free Microsoft Business Applications Launch Event.

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Top Kudoed Authors
Users online (3,374)