I have a flow that registers leave days.
* one sharepoint list keeps the leave days on the employee record
* one sharepoint list I create a transaction record
-> the flow takes the transaction record and updates the leave column on the employee record.
That mostly works. But then for some reason, every now and again it doesn't.
Whilst everything is exactly the same! (at least as far as I can see).
Mysterious.
here is a screenshot
The Compose action calculates the new leave.
the condition Sick Leave checks if leave does not go under zero
The return from the compose is always in the same format.
And sometimes the Condition Sick leave gives this error:
"Unable to process template language expressions for action 'Condition_Sick_Leave' at line '0' and column '0': 'The template language function 'int' was invoked with a parameter that is not valid. The value cannot be converted to the target type.'."
below a screenshot
As you can see the compose action returns a number. Which is correct.
Then the condition decides it cannot work with this number.
this is the condition code: int(outputs('Compose_SickLeave'))
and again: normally it works with the result from the Compose action.
hope someone knows that this might be.
power automate can be complex, but it should not be mysterious.
thanks in advance
Martijn
thanks Kaif,
this does make things clear. And I also understand how deconstructing it and then putting it together again makes a bullet proof integer.
What remains is that the flow did not accept the original 29.5 for this run, but other runs that included decimal integers were successful. So at that level, the mystery is not solved..
Hi @Martinus ,
Lets break the expression into sub expressions:
int(first(split(string(outputs('Compose_SickLeave')),'.'))) |
Hope this will help you.
Regards
Kaif
Dear Kaif,
Thanks a lot for this very speedy reply
I entered your suggested expression and it worked!
It is still a mystery to me though. 🙂
Can you perhaps explain what this expression does? and why it is required to make my flow work?
I'll wait for your reply on this before I post it as solved, because I don't know whether that would auto close this topic.
best,
Martijn
Hi @Martinus ,
Use this expression to convert Float to Integer:
int(first(split(string(outputs('Compose_SickLeave')),'.'))) |
Update the output as per Compose name
Let me know if any queries.
If you like my response, please give it a Thumbs Up.
If this helps, please Accept as solution.
Regards
Kaif
WarrenBelz
146,645
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,997
Most Valuable Professional