Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Using Flows
Answered

How to convert string to integer

(0) ShareShare
ReportReport
Posted on by 33

Hi everyone,

 

I am using a AI model to extract information from an invoice document. 

One of the extracted informations is the total value of the invoice, the extracted information as value is a total number, but the text result is the actual correct output since it´s providing the currency and the comma.

I now want to use the extracted text, convert it to int to use it in a condition to check, so if the amount is higher then 1000 a specific action has to happen.

Can anyone help me in setting up the correct flow?

lisa_garcia_0-1704267255425.png

 

  • lisa_garcia Profile Picture
    33 on at
    Re: How to convert string to integer

    Thanks so much @v-jefferni it worked! 

  • Verified answer
    v-jefferni Profile Picture
    on at
    Re: How to convert string to integer

    Hi @lisa_garcia ,

     

    Try below and you can get the currency:

    formatNumber(float(substring(outputs('Compose'),0,sub(length(outputs('Compose')),1))),'$ #,###.00')

     

    Best regards,

  • lisa_garcia Profile Picture
    33 on at
    Re: How to convert string to integer

    Hi @v-jefferni 

    thanks so much for helping me!

    So I´m geeting a result, but still missing the two digits.. How do I get the number right? 

    Tried float but it isn´t working...

    lisa_garcia_0-1704380317352.png

     

    regards

  • v-jefferni Profile Picture
    on at
    Re: How to convert string to integer

    Hi @lisa_garcia ,

     

    Just need to extract substring from the first digit:

    int(substring(outputs('Verfassen'),0,sub(length(outputs('Verfassen')),1)))

     

    Best regards,

  • lisa_garcia Profile Picture
    33 on at
    Re: How to convert string to integer

    hi @v-jefferni 

    It almost works but I´m missing a digit 

    lisa_garcia_0-1704285313195.png

    Any idea?

  • v-jefferni Profile Picture
    on at
    Re: How to convert string to integer

    Hi @lisa_garcia ,

     

    So, the currency symbol is in the end. You can edit the expression as follow:

    int(substring(outputs('Verfassen'),1,sub(length(outputs('Verfassen')),1)))

     

    Best regards,

  • lisa_garcia Profile Picture
    33 on at
    Re: How to convert string to integer

    Hi @v-jefferni 

    I tried your solution but get another error:

    lisa_garcia_0-1704274545602.png

    the compose 2 looks like this: 

    int(substring(outputs('Verfassen'),2,sub(length(outputs('Verfassen')),2)))
  • v-jefferni Profile Picture
    on at
    Re: How to convert string to integer

    Hi @lisa_garcia ,

     

    To convert currency string to number, you need below expression:

    int(substring(outputs('Compose'),2,sub(length(outputs('Compose')),2)))

    vjefferni_0-1704272132215.png

     

    Best regards,

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,605 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,946 Most Valuable Professional

Leaderboard

Featured topics

Restore a deleted flow