cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Tee_Latte
Regular Visitor

My Expression gets error, formatDateTime and addDays

Hi Everyone,

Need suggestion, as i got an error of my expression about the formatDateTime and addDays.

I compose with "addDays"  

 

"@addDay(item()?['Training_x0020_Date'],+1)"

Tee_Latte_0-1599745303491.png

 

 

 

['Training_x0020_Date'] is a filed in sharepoint list, this field was set to be "Date and Time".

 
 

Annotation 2020-09-10 205904.pngAnnotation 2020-09-10 205905.png

 

 

 
 

When running the flow, it gets error at this step of compose 

"Unable to process template language expressions in action 'Compose_2' inputs at line '1' and column '18549': 'The template language function 'addDays' expects its first parameter to be a string that contains the time. The provided value is of type 'Null'. Please see https://aka.ms/logicexpressions#adddays for usage details.'."

 

Please give an advice.

Thanks in advance.

 
1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Tee_Latte 

 

Since you're using Get items, this will return all the items and create an array. Are you expecting more than 1 item from get items?

 

If so, you will need to put everything inside a Apply to each loop.

 

If you're expecting 1 value by using a filter on your Get items, than you can use this expression:

addDays(first(outputs('Get_items')?['body/value'])?['Training_x0020_Date'],1)

 


Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





View solution in original post

4 REPLIES 4
Jcook
Super User III
Super User III

Hello @Tee_Latte 

 

Could you share a screenshot of your full flow. Is your action inside a Apply to each loop?


Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





Hi Jcook,

 

This is my full flow during construction. Not yet complete.

The compose section is not under the loop.

 

Tee_Latte_0-1599747449590.png

Thank so much.

Hi @Tee_Latte 

 

Since you're using Get items, this will return all the items and create an array. Are you expecting more than 1 item from get items?

 

If so, you will need to put everything inside a Apply to each loop.

 

If you're expecting 1 value by using a filter on your Get items, than you can use this expression:

addDays(first(outputs('Get_items')?['body/value'])?['Training_x0020_Date'],1)

 


Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





View solution in original post

Hi Jcook,

 

Thanks for your advice, after try to put in the loop (apply to each), it works.

Thank again. 

Helpful resources

Announcements
MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Top Kudoed Authors
Users online (53,868)