I have two sharepoint lists:
(1) lst_products
product_name | purchasing_manager |
apple | bob |
bananna | tom |
broccoli | alice |
garbage bags | jane |
(2) lst_product_vendors
vendor_name | product_name | price_per_unit_usd |
vendor a | bananna | 0.35 |
vendor a | broccoli | 0.65 |
vendor a | garbage bags | 2.10 |
vendor b | apple | 0.51 |
vendor c | apple | 0.45 |
vendor c | garbage bags | 2.65 |
vendor c | banana | 0.37 |
I am trying to create a gallery that will display the purchasing_manager for products supplied by a particular vendor. So for example:
To do so I have:
And tried a number of different things to get the vertical gallery to display the purchasing_manager from lst_products:
But no luck. What am I doing wrong here?
Solved! Go to Solution.
Well...starting from the end of your response and working up.
You will not get Choices to work. What you are looking for is Distinct - Distinct(lst_product_vendors, vendor_name)
Choices is for complex columns (Choices, Lookup, Person, etc)
This will give you a distinct list, but the formula I demonstrated actually takes this a step further. GroupBy essentially does a distinct as well, but it also returns the matching records to the distinct value. What I was going for was...do your formula in ONE place rather than two places.
This way, for your other list of purchasing managers, the information is already there...in the dropdown. We don't need to do more data actions to get it.
NOW...here is where the problem is. You have renamed your Title column in your lists. You can never really rename a column in SharePoint. It will always retain its original name. When you rename it, SharePoint will "remember" what you named it and will display it everywhere with the name you gave, but, under the covers...it is still the original name (Title in this case).
PowerApps honors the name change in most places, but in areas where you quote a name, it must be the original.
SO...
Here is what your formula needs to be:
AddColumns(
GroupBy(
AddColumns(
lst_product_vendors As _vendor,
"prodMgr", LookUp(lst_products, product_name=_vendor.product_name, purchasing_manager)
),
"Title", "_recs"
),
"Managers", Filter(_recs, !IsBlank(prodMgr))
)
I think in your example, if vendor A is selected, then Tom, Alice and Jane would be displayed...
For your Vendor cmbSelectVendors, set the Items property to:
AddColumns(
GroupBy(
AddColumns(
lst_product_vendors As _vendor,
"prodMgr", LookUp(lst_products, product_name=_vendor.product_name, purchasing_manager)
),
"vendor_name", "_recs"
),
"Managers", Filter(_recs, !IsBlank(prodMgr))
)
For the Managers Combobox, set the Items property to:
cmbSelectVendors.Selected.Managers
I hope this is helpful for you.
Thank you, @RandyHayes for the reply. I assume I am just dense since I can't get most things in powerapps to work but struggling to implement your suggestion. Here is what I am doing:
Two lists, lst_product_vendors and lst_products:
lst_product_vendors on Sharepoint:
lst_products
Back over to cmbSelectVendors, no dice:
Not even sure where to start with that formula but why wouldn't something as simple as the following work to just get a list of unique vendor_names in the combo box?
By setting Items = lst_product_vendors I can get it to do the following:
But if I only want to have to click on 'vendor a' once to view info in a gallery for the purchasing_managers responsible for product_names sold by 'vendor a'?
Well...starting from the end of your response and working up.
You will not get Choices to work. What you are looking for is Distinct - Distinct(lst_product_vendors, vendor_name)
Choices is for complex columns (Choices, Lookup, Person, etc)
This will give you a distinct list, but the formula I demonstrated actually takes this a step further. GroupBy essentially does a distinct as well, but it also returns the matching records to the distinct value. What I was going for was...do your formula in ONE place rather than two places.
This way, for your other list of purchasing managers, the information is already there...in the dropdown. We don't need to do more data actions to get it.
NOW...here is where the problem is. You have renamed your Title column in your lists. You can never really rename a column in SharePoint. It will always retain its original name. When you rename it, SharePoint will "remember" what you named it and will display it everywhere with the name you gave, but, under the covers...it is still the original name (Title in this case).
PowerApps honors the name change in most places, but in areas where you quote a name, it must be the original.
SO...
Here is what your formula needs to be:
AddColumns(
GroupBy(
AddColumns(
lst_product_vendors As _vendor,
"prodMgr", LookUp(lst_products, product_name=_vendor.product_name, purchasing_manager)
),
"Title", "_recs"
),
"Managers", Filter(_recs, !IsBlank(prodMgr))
)
Aha, you are the man! Thank you so much for the explanation -- would really be great if microsoft had some kind of instruction manual or documentation all in one place that addressed these kinds of things instead of links to 368,000 different articles, etc. but thank you again!
They kind of do, but it is obscure and usually laden with collections...which you rarely need.
The column rename thing trips up a lot of people too.
Glad you have it going now though!!
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.
User | Count |
---|---|
199 | |
72 | |
50 | |
41 | |
30 |
User | Count |
---|---|
256 | |
116 | |
95 | |
91 | |
76 |