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 :
Power Automate
Unanswered

Need help with flow

(0) ShareShare
ReportReport
Posted on by 61

I have a flow where in an Apply to each, the output from previous steps is a variable array. (Screenshot 1).  The next step in the apply to each section is a Filter Array where the from is Value from Get Items from a sharepoint list.  (Screenshot2)  My filter is @equals(item()?['ID'], items('Apply_to_each_varFinal')?['AssignedAttorney']).  I then use an Append to array to get results from the apply to each.  However, even though I can see that the filter should be working, I'm not getting anything in the body of my append to filter array (Screenshot 3).  Any help as to why this is not working would be greatly appreciated.  

 

Screenshot 1

rpitts_0-1674030738210.png

 

Screenshot 2

rpitts_1-1674030779806.png

 

Screenshot 3

 

rpitts_2-1674030843727.png

 

Categories:
I have the same question (0)
  • Sundeep_Malik Profile Picture
    6,484 on at
    Re: Need help with flow

    Hey @rpitts 

     

    This is happening because your ID is of type integer/number, and your AssignedAttorney is of type string. 

    Now in your filter array, you will have to convert either ID to a string type or AssignedAttorney to a integer type.

     

    So, try one of the following expressions in your filter array:

     

    @equals(string(item()?['ID']), items('Apply_to_each_varFinal')?['AssignedAttorney'])

     

     

    @equals(item()?['ID'], int(items('Apply_to_each_varFinal')?['AssignedAttorney']))

     

     

    I hope atleast one of them works for you 🙂

  • rpitts Profile Picture
    61 on at
    Re: Need help with flow

    Thanks Sundeep.  Very much appreciate the response. Unfortunately, I don't believe that's the issue.  The "AssignedAttorney" is already an integer, unless the action of adding it to the variable array (varStaging) is converting it from int to string.  Originally, it is the id of a lookup field "first(body('Filter_array'))?['AssignedAttorney/Id']".  That is what is being added to varStaging as "AssignedAttorney."  That said, I'm up for trying anything so I tried to convert to int and received this error:  "The execution of template action 'Filter_array_Final' failed: The evaluation of 'query' action 'where' expression '@equals(item()?['ID'], int(items('Apply_to_each_varFinal')?['AssignedAttorney']))' failed: 'The template language function 'int' was invoked with a parameter that is not valid. The value cannot be converted to the target type.'."   Any other ideas?  It's so frustrating.  

  • Verified answer
    Sundeep_Malik Profile Picture
    6,484 on at
    Re: Need help with flow

    @rpitts 

     

    Yup I think when you are adding it varStaging it's converting it to a string type, not exactly sure why it's happening, probably because it's a lookup. 

     

    If you see it in your screenshot correctly, the AssignedAttorney has double quotes, which totally shows that it's being converted to string somehow. 

    And when you are trying to match it with the Id, it's giving an error as both are not matching because of different data types.

    I gave you two expressions above, try the one with string. If that also doesn't work, I will try to think of any other method. 

  • Sundeep_Malik Profile Picture
    6,484 on at
    Re: Need help with flow

    @rpitts 

    Try one more thing, outside the apply to each initialize an integer variable.

    Inside the apply to each use set variable pass the AssignedAttorney in it. After this pass this variable in the filter array. Probably this should work.

  • rpitts Profile Picture
    61 on at
    Re: Need help with flow

    It was total user error.  As it usually is.  And now that I see it I feel so !!!  .  You turned me in the right direction by pointing out the quotes.  When I was running append to array, for the value I was designating it specifically and I had the ID object in quotes!!!!  so it was explicitly converting that to string which caused the bad result when using that variable downstream.  Thank you again for spending time on this.  I really appreciate it.  

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
Tomac Profile Picture

Tomac 497 Moderator

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 477 Super User 2025 Season 2

#3
chiaraalina Profile Picture

chiaraalina 242

Last 30 days Overall leaderboard