Skip to main content

Notifications

Power Automate - Using Flows
Unanswered

Int function error message

(0) ShareShare
ReportReport
Posted on by

I'd like to have anyone's advice regarding 'Int' function error as following.

I got error message;

 

'The template language function 'int' was invoked with a parameter that is not valid. The value cannot be converted to the target type'

 

So I removed 'int' from expression, but another error message coming;

 

'The template language function 'addDays' expects its second parameter to be an integer. The provided value is of type 'String'. Please see https://aka.ms/logicexpressions#adddays for usage details.'

 

What is the cause??

  • Michael Shen Profile Picture
    Michael Shen on at
    Re: Int function error message

     you need check the exact data in that run history, it looks like 

    item()?['11_Date of Study']

    returned the data that can't be converted into int 

  • Re: Int function error message

    @yashag2255 , thank you for you support.

    InvalidTemplate. The execution of template action 'Select_Array_from_Excel_for_Word' failed: The evaluation of 'query' action 'where' expression '{ "Date": "@formatDateTime(addDays('1899-12-31',int(item()?['11_Date of Study'])),'yyyy-MM-dd')", "Start": "@formatDateTime(item()?['12_Start Time'],'HH:mm')", "Rest": "@formatNumber(int(item()?['13_Rest Hour']),'0.0')", "Finish": "@formatDateTime(item()?['14_Finish Time'],'HH:mm')", "Hour": "@formatNumber(int(item()?['15_Hours']),'0.0')", "Curriculum": "@item()?['21_Curriculum']", "Dept": "@item()?['22_Tutor Dept JP']", "Trainer": "@item()?['23_Tutor Name JP']", "Impression": "@item()?['31_Impression']", "Completion": "@item()?['32_Completion']" }' failed: 'The template language function 'int' was invoked with a parameter that is not valid. The value cannot be converted to the target type.'.

    This is all error message what I got.

    formatDateTime(addDays('1899-12-31',int(item()?['11_Date of Study'])),'yyyy-MM-dd')

    This is my expression.

     

    Previously it was working well, but got error once change the data source excel file,,, but the file was generated from the same system with same process, so basically it should be the same contents. 

  • yashag2255 Profile Picture
    yashag2255 24,442 on at
    Re: Int function error message

    Hi @Anonymous 

     

    Can you check from the flow run history on what the value is being passed in the integer function? I am guessing it is being returned as a float so you might want to replace int with float. 

     

    If you can share more details and a screenshot, we might be able to assist you better. 

     

    Hope this Helps!

    Hope this Helps!

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,304

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,703

Leaderboard

Featured topics

Restore a deleted flow