0

We have a SharePoint column named "Types" of type Choice which allow multiple selections and allow Fill-in, as follow: -

enter image description here

so how I can implement this field inside our canvas form, where we will have to deal with these 3 scenarios:-

  1. ONLY select single/multiple choice without entering custom value.

  2. BOTH select single/multiple choice/s + enter a custom value

  3. ONLY enter a custom value

This should work inside the Add ,Edit & View built-in Power Apps forms...Here is the UI which i currently have >> to select available option/s and/or enter custom value:-

enter image description here

How to implement the logic for this field?

Dharman
  • 30,962
  • 25
  • 85
  • 135

1 Answers1

1

Each datacard in your form has an Update property. In this you can manipulate what is sent from the form to the SharePoint list. The items selected in the combobox will have to be merged with the freetext entry. To do that, you will have to use a trick with the UnGroup() function and match the JSON representation of the combobox selection:

Ungroup(
Table(
    { myDummyColumn: ComboBox.SelectedItems },
    { myDummyColumn: { Value: TextInput.Text } }
),
"myDummyColumn")
mmikesy90
  • 783
  • 1
  • 4
  • 11
  • @mmikeys90 ok thanks , and how i can show the custom value inside the custom field when viewing the form ? – microsoftdeveloperdesigner May 24 '23 at 15:27
  • I believe the DataCard.Default in this case would return both the standard values and the custom entry. But if the default setup of the form wouldn't work, you can still use a text label control with Concat(myRecord.ChoiceField,Value,"; "). If you want to make it look fancy, you can use the same formula on a HTML text control and add some CSS. Anyway, you have to configure the Visible property of the display control and the combobox based on the Form.Mode property to only appear when necessary. – mmikesy90 May 25 '23 at 13:56
  • @mmikeys90 thanks again for the reply. but if i use this formula `Concat(myRecord.ChoiceField,Value,"; ").` then it will show all the options selected and not just the custom value? am i correct?I mean in some cases a user might select 2 options from the combobox and enter a custom value inside the custom input field.. Now i want the combo-box to still show the 2 options been selected+ the custom field input to show the custom value entered.. did you get my scenario? this is similar to how the built-in classic (not modern) list forms works for Choice fields that allow fill-in options. – microsoftdeveloperdesigner May 26 '23 at 11:12