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 / Filter Array to get on...
Power Automate
Unanswered

Filter Array to get only odd rows.

(0) ShareShare
ReportReport
Posted on by 41

Hi,

 

got Array of values, which I got from "Get Items" action. Now trying to filter my array by ID to get only rows odd ID.

 

I now there is "Filter Array" action but not sure how to configure in advanced mode...

 

Can I somehow use function ISEVEN? Or similiar?

 

Thank you.

Ales  

Categories:
I have the same question (0)
  • Verified answer
    Paulie78 Profile Picture
    8,422 Moderator on at

    Use the mod expression.

  • chico Profile Picture
    638 on at

    this is marked resolved by using "mod"

    but is there an example on how that is being used?

     

  • kristof Profile Picture
    67 on at

    Hi @chico I am also looking for a more performant way to get it work with one single action called: Filter Array but I suck at prompting Bing🤖 to get a working expression so I am seeking from 💡tips for humans or PA aliens 👽. See screenshot from my current flow which uses an apply to each to filter every second item. 
    What should go left branch?What should go left branch?

     



  • kristof Profile Picture
    67 on at

    Just noticed that I hook up my questions to a bit different query. Here is the solution you are looking for @chico 

    Even numbers are those numbers which are divisible by 2 and odd numbers which are not divisible by two.

    So to get an array with IDs like 1,3,5,7...  you want to divide the ID by 2 and make sure there is a reminder. That's what the mod function will provide. It returns the remainder after a number is divided by a divisor.

    Mod( Number, Divisor )

    • Number - Required. Number to divide.
    • Divisor - Required. Number to divide by.

    In advance mode of you filter query
    @equals(mod(item()?['ID'], 2), 1)

    or you can use the opposite:
    @not(equals(mod(item()?['ID'], 2), 0))
    In regular way:

    UsernameIsTaken_0-1688143610178.png

     



  • chico Profile Picture
    638 on at

    this is niiiiice

  • takolota1 Profile Picture
    4,974 Moderator on at

    @chico @UsernameIsTaken 

    You could even set up a Select action to perform something on every other, every 5th, … every nth item in an array without any ID number column…

     

    How to perform something on every n items

    Select Action

    From: Range(0, length(PreviousOutput))

    Map: If(equals(0, mod(item(),n)),

    DoStuffHere,

    PreviousOutput[item()])

     

  • kaijiayongshi Profile Picture
    6 on at

    Can you go into more detail? Thank you~

  • kaijiayongshi Profile Picture
    6 on at

    kaijiayongshi_0-1701679651279.png


    The red fonts 1 and 2 in the array are serial numbers. Here are 2 examples. I want to get the yellow information at the end of the serial number.

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 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard