cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
gwengreniuk
Frequent Visitor

simple filter doesn't work, how can I filter a table based on the value in a choice field?

I'm tying a PowerApp as a Canvas App to D365 (CRM). I have a table called "Deposits" and in there I have a field called "Deposit Amount", one called "Related ID",  and another called "Deposit Type". Deposit type is a Choice field in Dataverse-speak, or an Option Set in CRM. One of those options is GST with the value 859270005. Related ID is a lookup (GUID), and Amount is a numeric field.

In the PowerApp, I want to update all records for a specific related ID, setting the Deposit Amount to 0 if the Deposit Type is "GST".

I'm trying to do this by first creating a collection, but none of the formats below work (I've removed the Related ID portion just to keep it as simple as possible):

ClearCollect(relatedDeposits,LookUp(Deposits,'Deposit Type'="GST"));
ClearCollect(relatedDeposits,LookUp(Deposits,'Deposit Type'='Deposit Type'.GST));
ClearCollect(relatedDeposits,LookUp(Deposits,'Deposit Type'=859270005));

None of these work. What format is intended/expected for PowerApps to filter like this? I've also tried a Filter statement in place of Lookup, same result. 

There is a screenshot in the attachments if that helps. I've been banging my head against a wall for two hours on this and can't find the answer. I'm sure it's something simple, so feel free to berate me if you're also providing me the answer 😉

Thanks

Garrett 

 

 



 

 

1 ACCEPTED SOLUTION

Accepted Solutions

HI @gwengreniuk ,

Try this

ClearCollect(
   relatedDeposits,
   Filter(
      Deposits,
      'Deposit Type'=[@'Deposit Type'].GST
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

View solution in original post

6 REPLIES 6
WarrenBelz
Super User
Super User

Hi @gwengreniuk ,

LookUp will produce a single record (the first one matching) - you need Filter for your Collection.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Jeff_Thorpe
Super User
Super User

I think the formula would look something like this:

ClearCollect(relatedDeposits, Filter(Deposits,'Deposit Type' = 'Deposit Type (Deposits)'.GST))

 



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

Hi Warren,

As noted in the description, I tried Lookup and Filter (in case there was a difference in the syntax), neither works.

I believe the issue is in the filter itself, that's what I'm attempting to resolve.

Thanks

Garrett

 

Hi Jeff,

The autocomplete doesn't show 'Deposit Type (Deposits)' as an option, and the syntax you provided doesn't work either. I've seen that format where a relationship exists, but in this case it's filtering on the same table so I'm assuming that's why I don't see the (Deposits) portion. 

Interestingly I notice the Autocomplete for the first 'Deposit Type' (left of the equals) actually shows the value twice... Maybe that gives an indication of why PowerApps doesn't seem to be recognizing the choice field properly?

Any other ideas?

Thanks,

Garrett

HI @gwengreniuk ,

Try this

ClearCollect(
   relatedDeposits,
   Filter(
      Deposits,
      'Deposit Type'=[@'Deposit Type'].GST
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

Hi @gwengreniuk ,

Just checking if you got the result you were looking for on this thread. Happy to help further if not.

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (2,435)