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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Convert Array number t...
Power Automate
Unanswered

Convert Array number to Integer

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

lardo5150_0-1660226219070.png

 

So the last output is a single number, as you can see in the above.  It is an array.

I need to convert this to an integer, so I can run it through a condition and check if it is greater or equal than to 5.

How can I convert this to integer?

I tried a compose with int, but that gave me an error as you see.

Categories:
I have the same question (0)
  • Hardesh15 Profile Picture
    7,087 Super User 2024 Season 1 on at

    @lardo5150  First use replace() and then int().

    Int(Replace(Replace(Output,'[',''),']',''))

    Please 'Thumbs Up' the posts that helped you and 'Accept as Solution' if my post answered your question.

    @Hardesh /Gopenly.in

  • lardo5150 Profile Picture
    Microsoft Employee on at

    Running into a syntax error.  Any idea what I am doing wrong here?

     

    lardo5150_0-1660227624672.pnglardo5150_1-1660227643200.png

     

  • Hardesh15 Profile Picture
    7,087 Super User 2024 Season 1 on at

    @lardo5150 First remove int and try to replace only and check output.

    Please 'Thumbs Up' the posts that helped you and 'Accept as Solution' if my post answered your question.

    @Hardesh /Gopenly.in

  • lardo5150 Profile Picture
    Microsoft Employee on at

    Did that.  It helped me find a syntax error.  So fixed that, ran it but got an error:

    Unable to process template language expressions in action 'Compose_2' inputs at line '0' and column '0': 'The template language function 'replace' expects its first parameter 'string' to be a string. The provided value is of type 'Array'. Please see https://aka.ms/logicexpressions#replace for usage details.'.

     

    int(replace(replace(body('SelectUnavailable'),'[',''),']',''))
     

    lardo5150_0-1660229139824.png

     

     

     

  • lardo5150 Profile Picture
    Microsoft Employee on at

    Ok, looks like I got it to work.

    The problem that complicates it is how do I change the null values to 0?

     

    Here is a null value

    lardo5150_0-1660229972490.png

     

     

    Working

    lardo5150_1-1660230002556.png

     

  • Hardesh15 Profile Picture
    7,087 Super User 2024 Season 1 on at

    @lardo5150  Either use expression empty() to check null or use condition block. 

    Please 'Thumbs Up' the posts that helped you and 'Accept as Solution' if my post answered your question.

    @Hardesh /Gopenly.in

  • lardo5150 Profile Picture
    Microsoft Employee on at

    Do you have example of both?

  • Hardesh15 Profile Picture
    7,087 Super User 2024 Season 1 on at

    @lardo5150  After Array use apply to each and pass array output. Then inside apply to each use compose and pass current loop item. Then use condition- Compose is not equal to Null then in Yes block use all actions which convert to int.

    Please 'Thumbs Up' the posts that helped you and 'Accept as Solution' if my post answered your question.

    @Hardesh /Gopenly.in

  • lardo5150 Profile Picture
    Microsoft Employee on at

    empty in the condition does not work.

    Everthing is marked as true.

     

    lardo5150_0-1660231341482.png

     

  • Hardesh15 Profile Picture
    7,087 Super User 2024 Season 1 on at

    @lardo5150  Use compose output in left side and Null expression in right side.

    Please 'Thumbs Up' the posts that helped you and 'Accept as Solution' if my post answered your question.

    @Hardesh /Gopenly.in

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard