Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

Toggle Not Filtering Datatable

(0) ShareShare
ReportReport
Posted on by 252

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:
  • Skybluekid Profile Picture
    Skybluekid 252 on at
    Re: Toggle Not Filtering Datatable

    @LaurensM 

     

    Thank you very much

  • Verified answer
    LaurensM Profile Picture
    LaurensM 12,510 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
    Skybluekid 252 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.

  • LaurensM Profile Picture
    LaurensM 12,510 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!

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,475

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,767

Leaderboard