I have screen that contains a gallery and form. When you select a gallery item the form populates with the data. This same form can be put into Edit mode with a button. Here is my problem. I can click edit and see all the values in the form but when I click Update, which submits the form, any combo box that has its Update property in this format, ComboBoxName.Selected.ColumnName, get written to the record as empty. Any combo box that has its Update property in this format, ComboBoxName.Selected.Value, gits written as expected. Why is that and how do I fix this?
I ended up removing all the Distincts and basically went through all of the combo boxes one-by-one. Looks like i got them all working as expected although I introduced a new bug but that is for another post.
Regarding the ComboBox with this in the Items property:
Distinct(Filter(Tactics, StartsWith('Tactic Name', Self.SearchText)), 'Tactic Name')
The Distinct function will return a single column Table named "Value". In the Update property of your DataCard, I assume you have:
'Your ComboBox Control'.Selected.Value
On the DefaultSelectedItems property of that ComboBox, you will need:
{Value: Parent.Default}
Regarding the ComboBoxes with these in the Items property:
Sort('Campaign Types','Campaign Type Name', SortOrder.Ascending)
Sort(Filter('Campaign Sources', 'Campaign Type Name' = CB_CampaignTypeReview.Selected.'Campaign Type Name'),'Campaign Source Name',SortOrder.Ascending)
In the Update property, I assume you have:
'Your ComboBox Control'.Selected.'Your Column'
In the DefaultSelectedItems property for both ComboBoxes, you will need:
LookUp(
'Campaign Types',
'Your Column' = Parent.Default
)
Explanation:
Your ComboBoxes which do not use the Distinct function in the Items property return a Table of records, and it is important that the Items property of your ComboBox control and the DefaultSelectedItems property share the same table schema.
Typically, we create a Single Line Text Column in SharePoint, and then insert that Single Line Text Column into an EditForm control. We then remove the Text Input control, and replace it with a different control (in your scenario, a Combo Box control). We also set the Update property to point at the selected value from that Combo Box.
However, if we add the following into the DefaultSelectedItems property, we could see the following error:
The ComboBox is expecting a Table. As a workaround, we can force a Value into the DefaultSelectedItems property using:
{Value: Parent.Default}
However, this approach does not work with Dataverse. As you have noticed, if you add a Label control and reference the ComboBox , even though a value is “displayed”, the Text will still return blank. This is will because we are supposed to pass a record into the control because that is what the ComboBox control expects.
To supply a record into the ComboBox, we can force the correct record into the ComboBox using the Lookup function.
@Akshansh-Sharma @Amik @v-jefferni
Thanks to all three of you for your responses. Let me see if I can answer your questions.
Distinct(Filter(Tactics, StartsWith('Tactic Name', Self.SearchText)), 'Tactic Name')
Sort('Campaign Types','Campaign Type Name', SortOrder.Ascending)
Sort(Filter('Campaign Sources', 'Campaign Type Name' = CB_CampaignTypeReview.Selected.'Campaign Type Name'),'Campaign Source Name',SortOrder.Ascending)
{dk_tactic: Parent.Default}
Hi @futr_vision ,
I assume you are using SharePoint lists as data sources of these Combo boxes. In the form, Combo boxes that don't work I think they are in LookUp columns, and you have changed the Items property to another list instead of the initial Choices function. That's why you are using ComboBoxName.Selected.ColumnName in Update properties.
If this is the case, please follow below steps:
1. in DefaultSelectedItems of those Combo boxes, the formulas will be like:
LookUp(FormulaInItemsPropertyOfThisComboBox, ColumnName.Value = ThisItem.ColumnName.Value)
2. in Update property of the Data card:
LookUp(Choices(SPlist.LookUpColumnName), Value = ComboBox.Selected.ColumnName)
Best regards,
@futr_vision - I suspect I know the cause but I do need you to clarify:
Hi @futr_vision
I agree what @Amik said it is probably related to what are your columns data type in your sharepoint list for those 4 combo boxes where you are facing this issue to elaborate on this
so first let us know what data types you are using for those 4 columns then we will be able to debug what code is not working for what reason
-------------------------------------------------------------------------------------------------------------------------
Please click Accept as solution if my post helped you solve your issue. If the content was useful in other ways, please consider giving it Thumbs Up 😉
@Amik I've also tried setting the Item property of the form to a global variable and setting the global variable on the selection of a record from the gallery. Just can't seem to get those combo boxes populated.
@Amik I'm not sure I understand your clarification but let me try and reword with more detail.
NOTE: One thing I am also noticing is that when I put the form into Edit mode with the Edit button the Update button is already active. That shouldn't be the case. Only when a change is made should it be active.
Hope this helps some. It seems like there is some issue with the form that is not registering the actual values as values but it is displaying them.
@futr_vision - to clarify, the fields in your list are correctly updated with the Combo Box selections when the SubmitForm operation is executed, but the selections made from those Combo Boxes are not preserved?
If yes, the reason would depend on the data types for those fields (Single Line Text, Single-Select Choice etc) and what you have in the DefaultSelectedItem property of those Combo Boxes.
WarrenBelz
146,651
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,997
Most Valuable Professional