I have a combobox that loads available items for selection from a SQL View...this table has about 600 records
I have another table(BOMDetails) that looks up the current selected item by id.
The Combobox "DefaultSelectedItems" property is set this way...
LookUp(BOM_View_Details,BoM_ID=ThisItem.PLM_BOM_ID),
This isn't working. I believe the reason is no shared ID. No FK.
So my idea was to create a variable and set it like so...
Set(varMyPLMBomID,LookUp(BOMDetails,BOMID=currentBOM.BOMID,PLM_BOM_ID))
and set the Combobox DefaultSelectedItems property this way...
Lookup(BOM_View_Details, BoM_ID=varMyPLMBomID) but this doesn't work either.
I created a label on the page and set it too varMyPLMBomID and it does not appear the variable is getting set.
Is there a better way for me to achieve the overall goal of populating the list via the view and setting the defaultselecteditem property to the previously saved value from the BOMDetails table?
Solved! Go to Solution.
The original formula you have for DefaultSelectedItems should be sufficient.
LookUp(BOM_View_Details,BoM_ID=ThisItem.PLM_BOM_ID)
As per your examples, that appears valid and should resolve to the first matching record.
A few things to confirm
Hi Gareth...thank you for the insight. I thought I was going crazy and I couldn't figure out why the default selected items wouldn't work. I knew the syntax was right and you confirmed it. I discovered the problem. While comparing the data in the two table columns that I'm comparing/searching is slightly different. The PLM_BOM_ID should be the same and the BoM_Id...however it is not. I need to rewrite the view to ensure there is the same amount of whitespace between each substring as the BOM_Details table.
That's why the default selected items wasn't populating. The difference in the whitespaces between the substrings didn't offer and exact match.
That's a real Palm to the Forehead moment.
So frustrating. Thank you for your help!
The original formula you have for DefaultSelectedItems should be sufficient.
LookUp(BOM_View_Details,BoM_ID=ThisItem.PLM_BOM_ID)
As per your examples, that appears valid and should resolve to the first matching record.
A few things to confirm
Hi Gareth,
Thank you for the response. I'm certainly having some trouble with this. To answer your questions...
ThisItem.PLM_BOM_ID is not populating in a label text property.
The Bom_Id is nvarchar(115) and the and the PLM_BOM_ID is nvarchar(50).
The combobox items are...
LookUp(BOM_View_Details,BoM_ID=ThisItem.PLM_BOM_ID)
Let me show you some workflow...
The page previous to the one in question is the BOM Gallery
The Add BOM Action HTML LINK is set...Set(currentBOM, ThisItem);
This link send me to the problem page...
The BOM Ref Combobox is set as....
The textbox and the label are both set...
LookUp(BOMDetails,BOMID=currentBOM.BOMID,PLM_BOM_ID)
I don't need those fields. They are only for testing
In the combobox...sometimes the defaultselectedItem actual appears but then it disappears.
I hope this helps
Did you add a label with ThisItem.PLM_BOM_ID to your gallery? Try that, and then save and re-open the studio. Does it populate then? If so, this may help with the irregularity of that field being pulled into the app. You can always hide the label, to keep the data forced into it (without user seeing it).
Let me know if that helps.
Hi Gareth...thank you for the insight. I thought I was going crazy and I couldn't figure out why the default selected items wouldn't work. I knew the syntax was right and you confirmed it. I discovered the problem. While comparing the data in the two table columns that I'm comparing/searching is slightly different. The PLM_BOM_ID should be the same and the BoM_Id...however it is not. I need to rewrite the view to ensure there is the same amount of whitespace between each substring as the BOM_Details table.
That's why the default selected items wasn't populating. The difference in the whitespaces between the substrings didn't offer and exact match.
That's a real Palm to the Forehead moment.
So frustrating. Thank you for your help!
@GarethPrisk I corrected the issue and when the page load the default selected item appears in the combo box but then disappears. Do you have any idea why that happens?
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
181 | |
52 | |
41 | |
39 | |
33 |
User | Count |
---|---|
262 | |
81 | |
71 | |
69 | |
66 |