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

Community site session details

Session Id : bKUF/gJkipHrox4OZhQA/6
Power Automate - Using Flows
Answered

How to convert string to integer

Like (0) ShareShare
ReportReport
Posted on 3 Jan 2024 07:35:19 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

 

I have the same question (0)
  • lisa_garcia Profile Picture
    33 on 08 Jan 2024 at 14:25:51
    Re: How to convert string to integer

    Thanks so much @v-jefferni it worked! 

  • Verified answer
    v-jefferni Profile Picture
    on 05 Jan 2024 at 06:23:00
    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 04 Jan 2024 at 14:59:20
    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 04 Jan 2024 at 01:33:07
    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 03 Jan 2024 at 12:35:07
    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 03 Jan 2024 at 09:54:23
    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 03 Jan 2024 at 09:36:37
    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 03 Jan 2024 at 08:55:53
    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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Tom Macfarlan – Community Spotlight

We are honored to recognize Tom Macfarlan as our Community Spotlight for October…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 626 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 374 Moderator

#3
Expiscornovus Profile Picture

Expiscornovus 284 Most Valuable Professional

Last 30 days Overall leaderboard

Featured topics

Restore a deleted flow