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 / Extract number value f...
Power Automate
Unanswered

Extract number value from array

(0) ShareShare
ReportReport
Posted on by 997 Super User 2024 Season 1

Hi, I'm doing a flow to determine the Year of Service of the employees. I calculate the Year of Service using Select and the output is in an array so I'm trying to extract that.

 

anonymous21_0-1656302297454.png

I want to extract the number '1' from the array and set the body afterwards as a variable to use it. 

 

anonymous21_1-1656302473592.png

All of them return empty array values. How can I extract the '1' and then Set Variable?

anonymous21_2-1656302596363.png

The Set Variable is to be used in condition like the picture above.

 

Thank you. 

 

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

    @syhrh initialize one string variable then Use append to string variable. Later use compose and pass variable by converting its value in integer use int().

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

    @Hardesh /Gopenly.in

  • syhrh Profile Picture
    997 Super User 2024 Season 1 on at

    @Hardesh15 I tried your way and I got this.

    anonymous21_0-1656578969494.png

    I don't get '1' but I get 'YearOfService:1'. How to fix it?

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

    @syhrh  Your Flow logic is not correct. Where is your apply to each? 

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

    @Hardesh /Gopenly.in

  • syhrh Profile Picture
    997 Super User 2024 Season 1 on at

    @Hardesh15 where should I put the apply to each and what's the value?

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

    @syhrh In append to string when you put your Year of service value which is an array that will apply loop automatically.

    Pls Share your flow screens. Also expand each action.

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

    @Hardesh /Gopenly.in

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

    @syhrh  Please click on 'switch map to text mode'

    Hardesh15_0-1656581060503.png

    Then in map field put your expresion-div(..). After that you will see output like this-[, , , ] Then use apply to each and pass select output and set variable value as current item.

    Hardesh15_1-1656581322793.png

     

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

    @Hardesh /Gopenly.in

  • syhrh Profile Picture
    997 Super User 2024 Season 1 on at

    @Hardesh15 

    I got this error when I try to convert it to integer.

    anonymous21_0-1656638595549.png

     

    This is my flow:

    anonymous21_1-1656638703959.png

     

    anonymous21_2-1656638727718.png

     

     

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

    @syhrh  last 2 steps are not required now. You can use one compose and pass variable year. You will have your year in compose output.

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

    @Hardesh /Gopenly.in

  • syhrh Profile Picture
    997 Super User 2024 Season 1 on at

    @Hardesh15 I tried to use compose to convert it to integer but when I use the condition it still says it's a string.

    anonymous21_0-1656760433717.png

     

    this is my flow:

    anonymous21_2-1656760652518.png

     

    anonymous21_3-1656760686321.png

     

    The error is the variable Year. Is it still not in integer?

     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 307 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 289

#3
Henil Profile Picture

Henil 127

Last 30 days Overall leaderboard