web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Conversion of a string...
Power Automate
Answered

Conversion of a string to Integer and removal of the last character in the string

(0) ShareShare
ReportReport
Posted on by 62

Hi,

 

I have an array of string which end with the letter 'T'. I was successfully able to remove the letter 'T' from the string by using: 

substring(outputs('Compose_-_Amount_Value'),0,sub(length(outputs('Compose_-_Amount_Value')),1)).
 
However, when I try to convert the output of the above expression, the system does not allow me to do so and given me the error:
Unable to process template language expressions in action 'Compose_2' inputs at line '1' and column '24945': 'The template language function 'int' was invoked with a parameter that is not valid. The value cannot be converted to the target type.'.
 
Can someone please help me resolve this.
 
Please note I have to have the integer value inserted into CDS.
 
Thanks!
Categories:
I have the same question (0)
  • ScottShearer Profile Picture
    25,290 Most Valuable Professional on at

    @dc23 

    Can you post screen shots of the relevant parts of your Flow?  That will make it much easier to assist.

     

     

  • dc23 Profile Picture
    62 on at

     

    Here you go:

     

    2020-04-02_12-44-13.png

     

     
     
     
  • ScottShearer Profile Picture
    25,290 Most Valuable Professional on at

    @dc23 

    If you strip the T off of your input you end up with 119.95 - the int() expression will not convert a decimal to an integer.

    You can strip off the .95 if you want and convert to an integer.  Please note that Power automate does not have a "round" expression that lets you round up or down.

     

     

  • dc23 Profile Picture
    62 on at

    In case I want to keep .95 as well. What can be done in that case.

  • ScottShearer Profile Picture
    25,290 Most Valuable Professional on at

    @dc23 

    If you want to keep the .95, that's OK but you won't have an integer by definition.

    What is your use case? 

  • Verified answer
    dc23 Profile Picture
    62 on at

    This is the value for amount extracted from an invoice and it needs to be inserted in CDS. Since it contained a T in the end, I managed to remove it, however, when I try to insert it into CDS since the datatype for Amount there is currency, it gives me an error that : The 'inputs.parameters' of workflow operation 'Create_a_new_record' of type 'OpenApiConnection' is not valid. Error details: Input parameter 'item/crad5_amount' is required to be of type 'Number/double'. The runtime value '"179 80"' to be converted doesn't have the expected format 'Number/double'.

  • ScottShearer Profile Picture
    25,290 Most Valuable Professional on at

    @dc23 try using the float() expression rather than int() and see if that works.

     

     

  • dc23 Profile Picture
    62 on at

    It worked.

     

    Thanks!

  • ScottShearer Profile Picture
    25,290 Most Valuable Professional on at

    @dc23 

    I'm glad it worked for you!

    Please mark my solution as Accepted so that others with a similar issue will be able to find their answer.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 791

#2
Valantis Profile Picture

Valantis 582

#3
Haque Profile Picture

Haque 529

Last 30 days Overall leaderboard