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

The template language function 'float' was invoked with a parameter that is not valid. Simple float conversion of string date

Hello all,

I am getting the following error message: Unable to process template language expressions in action 'Set_TheDate_2' inputs at line '0' and column '0': 'The template language function 'float' was invoked with a parameter that is not valid. The value cannot be converted to the target type.'.

 

AutomateFusion_0-1664375201500.png

 

I am trying to get a date into a numeric representation like Excel uses.  I am initializing the variable TheDate (1) as type Float (2).  I also am initializing a variable called TempDate (3) as type string (4) with the date entered (5).  In order to convert it I am using the float function on the variable TempDate (7) and the result is suppose to be in TheDate (6).   It is at step 6 I am getting this error.

 

Any help here would be appreciated.

2 ACCEPTED SOLUTIONS

Accepted Solutions
Expiscornovus
Super User
Super User

Hi @AutomateFusion,

 

The reason it is failing is because your string value simply is not a floating-point number, it is a datetime string value.

 

You can even check that now with the new isFloat function

 

isFloat('2022-09-26T13:55:32.0000000Z')

 

 

I think in your case you might want to use a ticks function instead. Ed Gonzales has a nice article about ticks:

https://www.flyingpolymath.com/post/moving-targets

 

 



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


View solution in original post

AutomateFusion
Frequent Visitor

This helped me to get on the right track.  I had to basically convert the excel data to a float variable and then compare it to a variable - I initialized the string variable (Yesterday) with the following:  startofday(adddays(utcnow(),-1)) and then initialized the float of 'Yesterday' by using this: ticks(variables('Yesterday')).   I was then able to figure out if the Excel row was created on a day great than the beginning of yesterday.   Thanks

View solution in original post

2 REPLIES 2
Expiscornovus
Super User
Super User

Hi @AutomateFusion,

 

The reason it is failing is because your string value simply is not a floating-point number, it is a datetime string value.

 

You can even check that now with the new isFloat function

 

isFloat('2022-09-26T13:55:32.0000000Z')

 

 

I think in your case you might want to use a ticks function instead. Ed Gonzales has a nice article about ticks:

https://www.flyingpolymath.com/post/moving-targets

 

 



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


AutomateFusion
Frequent Visitor

This helped me to get on the right track.  I had to basically convert the excel data to a float variable and then compare it to a variable - I initialized the string variable (Yesterday) with the following:  startofday(adddays(utcnow(),-1)) and then initialized the float of 'Yesterday' by using this: ticks(variables('Yesterday')).   I was then able to figure out if the Excel row was created on a day great than the beginning of yesterday.   Thanks

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (2,728)