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 Apps / Issue with Filtering J...
Power Apps
Suggested Answer

Issue with Filtering JSON Data in Power Apps

(0) ShareShare
ReportReport
Posted on by 4
Hi everyone,
 
I'm working on a Power Apps formula to filter and sort items in a gallery based on various conditions. Here is my current formula:
 
```powerapps: items property in my gallery
 
SortByColumns(
    If(
        IsBlank(txt_Search_VEI.Value),
        Filter(
            'Expiry Tracking System',
            Title in FormTemplatesName &&
            (IsBlank(dte_ReminderDateFilter.SelectedDate) ||
                'Reminder Date 1' = dte_ReminderDateFilter.SelectedDate ||
                'Reminder Date 2' = dte_ReminderDateFilter.SelectedDate ||
                'Reminder Date 3' = dte_ReminderDateFilter.SelectedDate) &&
            (
                (showPast && DateValue('Certification Expiry Date') < Now()) ||
                (showUpcoming && DateValue('Certification Expiry Date') >= Now()) ||
                (!showPast && !showUpcoming)
            ) &&
            (
                IsBlank(txt_Search_Add_Col.Value) ||
                txt_Search_Add_Col.Value in 'Additional Columns'  // Adjust this line for the desired matching logic
            )
        ),
        Filter(
            'Expiry Tracking System',
            txt_Search_VEI.Value in FormTemplatesName &&
            (IsBlank(dte_ReminderDateFilter.SelectedDate) ||
                'Reminder Date 1' = dte_ReminderDateFilter.SelectedDate ||
                'Reminder Date 2' = dte_ReminderDateFilter.SelectedDate ||
                'Reminder Date 3' = dte_ReminderDateFilter.SelectedDate) &&
            (
                (showPast && DateValue('Certification Expiry Date') < Now()) ||
                (showUpcoming && DateValue('Certification Expiry Date') >= Now()) ||
                (!showPast && !showUpcoming)
            ) &&
            (
                IsBlank(txt_Search_Add_Col.Value) ||
                txt_Search_Add_Col.Value in 'Additional Columns'  // Adjust this line for the desired matching logic
            )
        )
    ),
    colName,
    varSortDirection
)
 
```sharepoint
the data stored in my AdditionalColumns column:

[
    {"Choices":"NA","ColumnType":"Text","Data":"Susan Lim","Required":"Yes","Title":"ERS in charge"},
    {"Choices":"NA","ColumnType":"Date","Data":"10/30/2024","Required":"Yes","Title":"Date of Notification to Staff"},
    {"Choices":"NA","ColumnType":"Text","Data":"Mary Johnson","Required":"Yes","Title":"Staff Name"},
    {"Choices":"NA","ColumnType":"Text","Data":"123456","Required":"Yes","Title":"Staff ID"},
    {"Choices":"NA","ColumnType":"Text","Data":"East Office","Required":"Yes","Title":"Project Site"},
    {"Choices":"NA","ColumnType":"Text","Data":"IR992411","Required":"Yes","Title":"IRIMS number"},
    {"Choices":"NA","ColumnType":"Yes/No","Data":"true","Required":"Yes","Title":"Is it WICA"}
]
 
 
Instead of using txt_Search_Add_Col.Value in 'Additional Columns', how can I filter items based on the value in the Data key within the Additional Columns JSON structure?

Any suggestions on how to achieve this?

I used the solution from this link in youtube: https://www.youtube.com/watch?v=wQqetH2QLyk

Thanks in advance!

Categories:
  • Suggested answer
    CU18061035-1 Profile Picture
    Microsoft Employee on at
    hey 
     
    can u try this code:
    // In the OnStart or other relevant trigger to create the parsed collection:
    ClearCollect(
        colAdditionalData,
        ForAll(
            'Expiry Tracking System'.'Additional Columns',
            {
                Title: Title,
                Data: Data
            }
        )
    );
    
    // Updated Items formula for the gallery:
    SortByColumns(
        If(
            IsBlank(txt_Search_VEI.Value),
            Filter(
                'Expiry Tracking System',
                Title in FormTemplatesName &&
                (IsBlank(dte_ReminderDateFilter.SelectedDate) ||
                    'Reminder Date 1' = dte_ReminderDateFilter.SelectedDate ||
                    'Reminder Date 2' = dte_ReminderDateFilter.SelectedDate ||
                    'Reminder Date 3' = dte_ReminderDateFilter.SelectedDate) &&
                (
                    (showPast && DateValue('Certification Expiry Date') < Now()) ||
                    (showUpcoming && DateValue('Certification Expiry Date') >= Now()) ||
                    (!showPast && !showUpcoming)
                ) &&
                (
                    IsBlank(txt_Search_Add_Col.Value) ||
                    LookUp(
                        colAdditionalData,
                        Data = txt_Search_Add_Col.Value,
                        true
                    )
                )
            ),
            Filter(
                'Expiry Tracking System',
                txt_Search_VEI.Value in FormTemplatesName &&
                (IsBlank(dte_ReminderDateFilter.SelectedDate) ||
                    'Reminder Date 1' = dte_ReminderDateFilter.SelectedDate ||
                    'Reminder Date 2' = dte_ReminderDateFilter.SelectedDate ||
                    'Reminder Date 3' = dte_ReminderDateFilter.SelectedDate) &&
                (
                    (showPast && DateValue('Certification Expiry Date') < Now()) ||
                    (showUpcoming && DateValue('Certification Expiry Date') >= Now()) ||
                    (!showPast && !showUpcoming)
                ) &&
                (
                    IsBlank(txt_Search_Add_Col.Value) ||
                    LookUp(
                        colAdditionalData,
                        Data = txt_Search_Add_Col.Value,
                        true
                    )
                )
            )
        ),
        colName,
        varSortDirection
    )
    
    if it helped please mark as verified answer,
     
    cheers
  • weiliang Profile Picture
    4 on at
    @mmbr1606
     
    Thanks for your help, but no idea why it doesnt work on my end. :(
  • CU29101231-0 Profile Picture
    1,424 Super User 2026 Season 2 on at
    can u et us know what the error is?

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 Apps

#1
11manish Profile Picture

11manish 224 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 189 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 126

Last 30 days Overall leaderboard