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

Flow: Compose can't seem to get the right syntax

Hello,

 

I'm trying to create a flow to import an Excel sheet into a Sharepoint list. My Excel contains a date column, but that is formatted as a string and not in the right (M/D/YYYY) format so that Sharepoint understands the input. I added a compose action to convert my current format dd-mm-YYYY to M/D/YYYY, but whatever I try I do not seem to get the right syntax. I tried several methods, so I hope someone can point me to the right one.

 

I tried:

Input:

"@formatDateTime(body('Get_row')['@{items('Apply_to_each_3')?['Einddatum']}'],'M/D/YYYY')"

Error:

The template validation failed: 'The template action 'Einddatum' at line '1' and column '1592' is not valid: "Unable to parse template language expression 'formatDateTime(body('Get_row')['@{items('Apply_to_each_3')?['Einddatum']}'],'M/D/YYYY')': expected token 'RightSquareBracket' and actual 'Identifier'.".'.
 

Input:
"@split(triggerBody()['@{items('Apply_to_each_3')?['Einddatum']}'], "-")'"

Ouput:

"@split(triggerBody()['31-12-2006'], "-")'"

 

Input:

"@split(@items('Apply_to_each_3')?['Einddatum'], "-")"

Output:

"@split(@items('Apply_to_each_3')?['Einddatum'], "-")"

 

Any help is appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions

I finally managed to get this working. Apparently you have to create multiple compose actions to achieve this.

The flow now looks like this:

image.pngimage.png

 

It would be much easier to tell Sharepoint what the input format is (like: dd-mm-yyyy) and let it store it the way it wants.

View solution in original post

3 REPLIES 3
v-yuazh-msft
Community Support
Community Support

Hi @ thyestes,

 

Could you please share a screenshot of your flow's configuration?

Do you want to insert the value of “Date” in your excel to a “Date” column in the sharepoint list?

 

Firstly, when insert value to the “Date” column in the sharepoint list, the action “Create item” of shareponit connector could convert the “Date” with type “dd-mm-YYYY” to type “MM/dd/yyyy” automatically.

I have made a test on my side, the screenshots  of my excel table as below:

 1.png

 

You could choose the “Date” dynamic content of the “Get rows” action as screenshots below:

 

2.png

 

The flow would run successfully as screenshots below:

 

3.png

And an item would be created in the sharepoint list as below:

 

4.png

 

Secondly , if you would like to convert the value  of “Date” in your excel before the action “Create item” ,you could refer to workaround below:

 5.png

 

The difference of the second flow with the first flow:

  1. Add a Compose, choose the “Date”dynamic content of the “Get rows”action in the Inputs field of the “Compose”.
  2. Fill in the “duedate” field of the “Create item” action with expression below:

 

formatDateTime(outputs('Compose'),'MM/dd/yyyy')

 

 

The flow would run successfully as screenshots below:

 

6.png

 

The second item would be created in the sharepoint list as below:

 7.png

 

 

 

You could learn more about the Workflow Definition Language refer to link below:

https://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-workflow-definition-language

 

 

 

Regards,
Alice Zhang

Hi @v-yuazh-msft

 

Thanks for the explanation. Unfortunately the the column in Excel is not formatted as date. If it was it would make things much easier, but the Excel file is a dump form another system and the date column is formatted as 'general'. My approach was to split the string into 3 arrays and then format it in the correct way using concat. The 'Einddatum' is a string with 'dd-mm-yyyy' but unfortunately I cannot get the right syntax.

This is my flow:

image.png

image.png

I finally managed to get this working. Apparently you have to create multiple compose actions to achieve this.

The flow now looks like this:

image.pngimage.png

 

It would be much easier to tell Sharepoint what the input format is (like: dd-mm-yyyy) and let it store it the way it wants.

View solution in original post

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

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

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Kudoed Authors
Users online (3,723)