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 / Using variable in item...
Power Automate
Unanswered

Using variable in item() function. Bug?

(0) ShareShare
ReportReport
Posted on by 180
Hi All,
 
I thought of something smart (not really), but it isn't working as expected. It seems to be a bug, but maybe I'm missing something.
 
I would like to perform the same actions on multiple SharePoint columns. To not have to create parallel branches or multiple flows, I want to put the column names in an array and loop through the array. 
 
This is my flow:
 
This is the content of the array variable:
[
{
"Certificate": "Demeter",
"Column": "'DemeterGeldigtot'"
},
{
"Certificate": "Skal",
"Column": "'SkalGeldigtot'"
}
]
 
And this is the filter query of the filter array:
@not(equals(@{item()[items('For_each_Column')['Column']]},@{null}))
 
I'm referencing the variable in the item() function. Maybe this isn't possible. 
 
This is the error I get from the "Filter array" action:
 
The execution of template action 'Filter_array_-_Cerificate_column_not_empty' failed: The evaluation of 'query' action 'where' expression '@not(equals(item()[items('For_each_Column')['Column']],null))' failed: 'The template language expression 'not(equals(item()[items('For_each_Column')['Column']],null))' cannot be evaluated because property ''DemeterGeldigtot'' doesn't exist, available properties are '@odata.etag, ItemInternalId, ID, Title, Code, Beoordeling, Status_x0020_obv_x0020_Transacti, E_x002d_mail, Landcode, Plaats, Adresregel1, Postcode, AangepastinExact, Status, IsConcurrent, IsDealer, Uitsluitenmarketing, Leverancier, Telefoonnummer, Startdatum, Geblokkeerd, ID0, Actief, Modified, Verkoop, IDHoofdcontact, Staat_x002f_Provincie, IsAccountant, Code_int, DemeterGeldigtot, SkalGeldigtot, GGGeldigtot, TypeRelatie, TypeRelatie#Id, IFSGeldigtot, LaatsteTransactieExact, Verklaring_x0020_nodig, VerklaringGetekendOp, Verklaring_x0020_Geldig_x0020_to, KwaliteitsbeoordelingJOST, KwaliteitsbeoordelingJOST#Id, ResidubeoordelingJOST, ResidubeoordelingJOST#Id, ToelichtingUitzondering, LastupdatePA, Test_x0020_Today, Now, Dummy, Created, Author, Author#Claims, Editor, Editor#Claims, {Identifier}, {IsFolder}, {Thumbnail}, {Link}, {Name}, {FilenameWithExtension}, {Path}, {FullPath}, {HasAttachments}, {VersionNumber}'. Please see https://aka.ms/logicexpressions for usage details.'.
 
Power Automate says the column 'DemeterGeldigtot' does not exist, but that is not true. It exists and there is no typo. If I try it with another column, it gives me the same error (with the other column name).
 
In this example I tried to put additional quotation marks in the array, to see if that helped. The same result, but with the additional quotation marks.
 
The Compose gives me the same output, nl.: 'DemeterGeldigtot'
This is the Input:
@{items('For_each_Column')['Column']}
 
Is this a bug or am I missing something. And maybe there is another way to achieve it.
 
 
*EDIT*
As a test, I have also tried to remove the for each loop and reference the first item of the array directly, with this expression in the filter query:
@not(equals(@{item()[variables('CertificateColumns')[0]['Column']]},@{null}))
 
This gives me the same result.
Categories:
I have the same question (0)
  • Suggested answer
    David_MA Profile Picture
    12,966 Super User 2025 Season 2 on at
    How you are using the filter array is not correct. You would not put the filter array action into an apply to each. You would use the filter to only get the items from the get items action for which you want to filter. Your current filter is not correct either. For an item to exist from the get items action, it has to have some content even if it is just the ID, created by, modified by, created and modified dates. What are you actually trying to filter out?
     
    This is how it would be used where I want to filter out the items from the get items action and the archive date is not null. You would then put the body of the filter into an apply to each to process just the items that meet the filter.
    However, a more efficient way of doing this is to use a filter query on the get items action so that the filter array action is not even needed:
    This way, it only returns what you need and not everything in the list, which will cause problems if you have a large list. If you have a field in your list named Column and you only want to return items where it is not null, just replace ArchiveDate with Column in my example above. Note, the filter query on the get items action uses the internal name of the field and not the display name.
     
  • JOAS_Niels Profile Picture
    180 on at
    Hi David,
     
    Thanks for your reply! But I think you may be missing my intention. 
     
    I know how to use the filter array action in general and I already have a filter query in the Get Items action.
     
    However, I would like to do the same actions on several columns from the output of the Get Items, with a filter array action for starters. 
     
    Like this:
    - filter date column with no values. 
    - check which dates have expired.
    ( I know that I could do it in one action)
    - send an email for expired records.
     
    Then on the next date column, do the same actions.
     
    I have put the specific column names in an array, so that I can cycle through them.
     
    I hope this clarifies some things.
  • David_MA Profile Picture
    12,966 Super User 2025 Season 2 on at
    @JOAS_Niels I am still not following. I think you'll need to wait for someone else to reply. From your new explanation I would say the same thing, which would be to use a filter query on the get items action. You can have a compound filter that does what you describe (Column is not null and the expiration date has expired).
     
    The filter query might look like this: Column ne null and ExpirationDate lt '@{formatDateTime(utcNow(), 'yyyy-MM-dd')}'
     
    Then just use an apply to each on the items returned to send the e-mail. 
     
    Good luck!
  • JOAS_Niels Profile Picture
    180 on at
    Thanks @David_MA,
     
    I understand what you are saying. But what if I wanted to do the thing you say also for column2 and then column3, then column4, etc.
     
    I would have to create a flow for every column independently. And that is what I want to avoid. I want to do it in one flow, if possible.
     
    It could work with my approach, but it seems the item() function does not work well with variables.
  • Verified answer
    JOAS_Niels Profile Picture
    180 on at
    I managed to find the cause of the error. It was not in the item() function, but it was the fact that the Get Items action does not return the column when the column is empty.
     
    So in fact the error was correct, but I wasn't aware of this functionality. So a feature not a bug.
     
    I resolved it by using a http request instead of the Get Items action.

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