cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
RayRay
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
v-zhos-msft
Solution Sage
Solution Sage

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
v-zhos-msft
Solution Sage
Solution Sage

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.

 

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (3,606)