Skip to main content

Notifications

Power Automate - Building Flows
Suggested answer

Filter Select Action Output Array to Only get Numeric Values

Posted on by
llo,
 
I have an array of strings that contains both words and numbers.  I want to filter the array to only show the items that are exclusively numeric.  In other words, I only want the items whose value is like "12345" and I do not want items that contain values like "abcdef" nor "abc123def".
 
The array is coming from a Select action and the raw output looks like this.  

 
 
 
{
    "body": [
        {
            "Text Values": [
                "PREVIOUS SHIFT",
                "37868",
                "SECONDS",
                "TOTAL TIME",
                "58402",
                "SECONDS",
                "2 SHIFTS PREVIOUS",
                "34247",
                "SECONDS",
                "DAY TIME STAMP",
                "32084",
                "SECONDS"
            ]
        }

 
 
 
I've tried using the Filter Array action to filter out non-numeric items like so... 

 
 
 
          
 
 
 
          
 
 

 
But I get the following error on the Filter Array when I run the flow.
 
 
 
 
Action 'Filter_array' failed: The execution of template action 'Filter_array' failed: The evaluation of 'query' action 'where' expression '@equals(isInt(item()),true)' failed: 'The template language function 'isInt' expects its first parameter 'string' to be a string. The provided value is of type 'Object'. Please see https://aka.ms/logicexpressions#isInt for usage details.'.
 
 
I would like the final output to be an array or table that contains only the numeric values.
 
 
Help please!
  • Suggested answer
    EKarim Profile Picture
    EKarim 10,232 on at
    Filter Select Action Output Array to Only get Numeric Values
    Try:

     
    In the filter array action, I used the following expression in the FROM property:
     variables('varData')?['body']?[0]?['Text Values']
     
    Switch the Filter Array mode to Advanced Mode:
     
    Use the following query:
    @isInt(item())
     
     
    The runtime output is:
     
    Remember that the output will be an array of "strings". Use the int function to convert to integers.





    This is the runtime output:


    Ellis
     

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

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,297

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,890

Leaderboard