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 / Toggle Not Filtering D...
Power Apps
Answered

Toggle Not Filtering Datatable

(0) ShareShare
ReportReport
Posted on by 262

Hi 

 

I have a Datatable that pulls back all the Delivery notes from a Part number.  It uses the below formula:

 

With({aFilter: Filter('Tbl Delivery Dev2','ORDER REF'=POTableDescrip_1.Selected.'ORDER REF')},
Filter(aFilter,
If(TogDesPO2.Value,'ORDER REF'=POTableDescrip_1.Selected.'ORDER REF',true),
If(TogDesDelivery2.Value,STATUS="Delivered",true)
)
)

 

I have a toggle(TogDesPO2.Value) that looks at another datatable, which contains Purchase Order numbers for the same part number.

 

When the toggle is off it should bring back all the delivery notes for that part number, which it doesn't.  When the toggle is on, it should only show the delivery notes for the selected Purchase Order number, which it does.

 

Any help would be appreciated.

Categories:
  • LaurensM Profile Picture
    12,516 Moderator on at

    @Skybluekid,

     

    You prefilter the table by order reference and then run the same order reference filter condition on the filtered dataset only if a toggle is set to true. I don't think the With() function is necessary here, could you try the following adjustment:

    Filter(
     'Tbl Delivery Dev2',
     //Or toggle is false, or filter by order ref
     !TogDesPO2.Value || 'ORDER REF'=POTableDescrip_1.Selected.'ORDER REF',
     !TogDesDelivery2.Value || STATUS="Delivered"
    )
    

    The code above also avoids the If statement that could cause issues (delegation warnings & true output that does not return any records).

     

    If this solves your question, would you be so kind as to accept it as a solution & give it a thumbs up.

    Thanks!

  • Skybluekid Profile Picture
    262 on at

    Thanks @LaurensM 

    I think I made a slight error when describing.  What I should have said is that if in the PO Table it has returned two PO for a part number, the unfiltered Delivery note table should return all delivery notes for those two PO's only, not all delivery notes in the list.  Then if the TogDesPO2 is switched to true then only the selected value delivery notes are displayed.

  • Verified answer
    LaurensM Profile Picture
    12,516 Moderator on at

    Hi @Skybluekid,

     

    As I understand it now the initial With filter is necessary. However, the initial filter also filters on the selected reference from POTableDescrip_1 - to my understanding this should be the Part Number filter. Below you can find a sketch of the possible architecture:

     

    With(
     {
     //Filter by part number
     aFilter: Filter('Tbl Delivery Dev2',PartNumberColumn = PartNumberValue)
     },
     Filter(
     aFilter,
     //Or toggle is false, or filter by order ref
     !TogDesPO2.Value || 'ORDER REF' = POTableDescrip_1.Selected.'ORDER REF',
     !TogDesDelivery2.Value || STATUS = "Delivered"
     )
    )

    Please adjust PartNumberColumn to the correct column name and PartNumberValue to the current part number value.

     

    I hope this helps!

  • Skybluekid Profile Picture
    262 on at

    @LaurensM 

     

    Thank you very much

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 248 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 192 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard