I have a Datacard in the EditForm with default value as "Car,Bus".
I have placed a Multi select Combo box within the Data card and assigned items property to a collection of 3 columns:
ID | FieldID | FieldName |
1 | 102 | Car |
2 | 104 | Bus |
3 | 109 | Bicycle |
The default value of the data card is "Car,Bus". Now, I am using the below formula in the DefaultSelectedItems property of the Combo box to select the items by default.
DefaultSelectedItems:
ForAll(Split(Parent.Default,","), Lookup(colTest, FieldName = Result))
Now the issue is that the combo box is not displaying the selected items visually. However, I am able to retrieve the selected items from the combo box into a text box.
Combobox1:
Textbox:
Default = Concat(Combobox1.SelectedItems, FieldName & ":" & FieldID)
Please help me to select the items in the combo box based on the default value of the datacard.
hi @VenuRebbala Leave DefaultSelectedItems property empty only. let me know if this helps.
But that would not help in selecting the DefaultSelectedItems.
I would like to select the items "Car,Bus" in the combobox by default .
Assuming colTest is your datasource, why not keep the DefaultSelectedItems = colTest only. this will select all your records and will keep on changing as you change your selections from the dropdown.
I do not want all the records to be selected by default.
I want only those records to be selected which are already there in the data card.
I have reframed the question to make it more understandable
Please can anyone suggest/help me to resolve the above problem?
in the OnVisible property of your screen where your Edit form is present, create a new collection which will store the values from the datacard. Code below:
Collect(colDatacardvalues,
{
FieldName:DataCardValue6.Text
},
{
FieldName:DataCardValue3.Text
}
)
In your dropdown, make the following changes:
In the DefaultSelectedItems property, add this code:
colDatacardvalues.FieldName
Set the DataSource property to coltest collection.
Set the Items property to coltest.FieldName
This should give a hint of what you are trying to achieve.
Please note that there is no validation being done here as to whether the values in the datacards are present in collection colTest which is used as the datasource of the dropdown. So if any values which are displayed in the datacards, are not present in the dropdown items, you will still able to see them in the default selected items of the dropdown.
Yes, I could select all the delimited values of the datacard without validation using the formula
DefaultSelectedItems = ForAll(Split(Parent.Default,","), {FieldName : Result})
However, I need validation, which is very important in my case.
Hi @VenuR
I have updated the code for OnVisible property of the screen as shown below and hope this helps you. This may not be a very good workaround but for now, this will solve your issue and you can do the fine tuning later.
If(DataCardValue6.Text in coltest.FieldName,
If(DataCardValue3.Text in coltest.FieldName,
ClearCollect(colDatacardvalues,{FieldName:DataCardValue3.Text},{FieldName:DataCardValue6.Text}),
ClearCollect(colDatacardvalues,{FieldName:DataCardValue6.Text})));
Thanks,
James
Hi @JamesYumnam
What are DataCardValues 3 & 6?
I could do partial validation using below formula, however, as you mentioned, this doesn't exactly match.
DefaultSelectedItems = Filter(colTest, FieldName in Split(Parent.Default,","))
For example: Data card value is "car" and colTEst has FieldNames "car, car1, car2, bus, bicycle etc." Then with the above formula, all the fieldnames which has "car" text would be selected.
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 |
---|---|
183 | |
51 | |
47 | |
32 | |
32 |
User | Count |
---|---|
266 | |
91 | |
78 | |
68 | |
67 |