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 Apps - Building Power Apps
Answered

Toggle Not Filtering Datatable

(0) ShareShare
ReportReport
Posted on by 254

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:
I have the same question (0)
  • LaurensM Profile Picture
    12,512 Moderator on at
    Re: Toggle Not Filtering Datatable

    @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
    254 on at
    Re: Toggle Not Filtering Datatable

    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,512 Moderator on at
    Re: Toggle Not Filtering Datatable

    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
    254 on at
    Re: Toggle Not Filtering Datatable

    @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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 766 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 419 Super User 2025 Season 2

#3
developerAJ Profile Picture

developerAJ 235

Last 30 days Overall leaderboard