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

FORMAT DATE USING COMPOSE

Please i am getting this error in an attempt to format a sql date; 

formatDateTime(triggerBody()?['Date'],'dd-mmm-yyyy')

 

this is the error;

InvalidTemplate. Unable to process template language expressions in action 'Compose_2' inputs at line '1' and column '2192': 'The template language function 'formatDateTime' expects its first parameter to be of type string. The provided value is of type 'Null'. Please see https://aka.ms/logicexpressions#formatdatetime for usage details.'.

 

attached is my flow

11 REPLIES 11
Highlighted
Super User II
Super User II

Re: FORMAT DATE USING COMPOSE

inspect your trigger, is date null it sounds like it is?

 

is this a document with metadata? add a delay of 1 minute and then do a get file properties using the id from the trigger.

Highlighted
Helper II
Helper II

Re: FORMAT DATE USING COMPOSE

 

The date column is not null.

FLOW DATE.JPG

Highlighted
Dual Super User III
Dual Super User III

Re: FORMAT DATE USING COMPOSE

Can you provide a screenshot of the output of your compose action?  Something about the way the date is formatted as input is wrong.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Highlighted
Helper II
Helper II

Re: FORMAT DATE USING COMPOSE

Capture5.JPG

Highlighted
Helper V
Helper V

Re: FORMAT DATE USING COMPOSE

Looks like there are 3 m’s there in your expression; I think you’re looking for ‘dd-MM-yyyy’ instead.
Highlighted
Community Support
Community Support

Re: FORMAT DATE USING COMPOSE

 

Hi @eka ,

 

What is the data source for PowerApps connections?

As far as I know, if you use the PowerApps button as a trigger, the Dynamic content output by the trigger is automatically generated based on the corresponding action.

110.PNG

So expressions such as triggerBody()?['Date'] are not able to get the specified field value.

 

Please refer to this online doc for more details on PowerApps integration with MS Flow:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/using-logic-flows

Then use the correct expression to get the value of the Date column and convert it using the formatDateTime() function.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Helper II
Helper II

Re: FORMAT DATE USING COMPOSE

I am using Azure Sql as data source as shown in the picture i posted

Highlighted
Community Support
Community Support

Re: FORMAT DATE USING COMPOSE

 

Hi @eka ,

 

If PowerApps does the job of adding a new line, then I recommend that you use When an item is created (V2) as the trigger instead of the PowerApps button.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Helper II
Helper II

Re: FORMAT DATE USING COMPOSE

I tried formatDateTime(triggerBody()?['Date'],'dd-MM-yyyy') but still get the error attached;

 

Capture9.JPG

Highlighted
Community Support
Community Support

Re: FORMAT DATE USING COMPOSE

 

Hi @eka ,

 

Maybe you could try to use When an item is created (V2) as the trigger instead of the PowerApps button.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Dual Super User III
Dual Super User III

Re: FORMAT DATE USING COMPOSE

I think your problem is that you are accessing the wrong date field.  triggerBody()?['Date'] would be a parameter coming in from Power Apps  I think what you want is the following:

formatDateTime(body('Get_row_(V2)')?['Date']),'dd-mmm-yyyy')

You are trying to format a parameter coming in from the trigger, not a date field in the SQL row.  I suspect that is why its telling you its null 



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

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.

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Users online (7,787)