Hello, can you help me? I have a collection which looks like this:
Collect(
ErrorCodes,
"SOX-DOC",
"QA-EU",
"QA-CON"
);
I need to add a button for user, which will add a new values to a combobox. As I see in a Lookup function you have
ColumnName1 = TextInput1.Text
, but I don't have column name in my collection. This is just list of error codes, how can I write a code for this case?
I want to do this very thing. Did you figure it out?
Hi,
I have similar problem:
I have 2 share point lists (Invoices and Suppliers) and I'm working on power app of 1st list. In this power app I have 2 forms.
on the 1st one has source of the 1st list (Invoices) where I enter suppliers from a drop list . When I want to add a new supplier, I have a button to navigate to the 2nd form with data source of 2nd list (suppliers)
The problem is starting when I enter a new supplier (within 2nd form) and when I save the supplier record, I navigate back to 1st form but drop list is not updated with the new supplier.
I tried the above with negative results. Could you assist me ?
Selected Items property seemed to do it.
Thanks
Thanks - it all seems to work except the last part of defaulting the ComboBox to the added item.
Change your code in the OnSelect property of your "Add Option" button.
Set(newOption,
If(
IsBlank(LookUp(your_datasource_name, ColumnName1 = TextInput1.Text)),
Patch(
your_datasource_name,
Defaults(your_datasource_name),
{ColumnName1: TextInput1.Text}
)
)
)
Then put this code in the DefaultSelectedItems property of your ComboBox
LookUp(your_datasource_name, ID = newOption.ID)
This example assumes your AllowMultipleSelections setting is.
false
---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."
Thanks - I meant how to get the new value to appear as the selected one.
Yes, this could work in a form.
To get the new values to appear in the ComboBox you could simply Refresh the datasource.
Refresh(your_datasource_name)
---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."
Thanks for the reply.
I just wanted to ask if this would work in a form.
I know a form limits to controls from the data source so I wondered if it was possible to add a text box (to enter new items) to the form?
I could just patch all control values and not use a form at all, but wanted to know if your solution could work in my form environment.
The other issue is how to get the newly saved value as the selected item in the ComboBox?
I was thinking of saving the item to a context variable, but how to get it to display as the chosen item?
Thanks
Typing a new value to add into a ComboBox is complicated. The reason is you are supplying a single value but a ComboBox is populated by records which contains multiple values. The question is, how do you intended to fill-in those other values assuming you have more than 1 column in your list.
You have the right idea how to approach adding it. Put code like this in the OnSelect property of your button. This assumes the column you are adding information to is plain-text.
Patch(
your_datasource_name,
Defaults(your_datasource_name),
{ColumnName1: TextInput1.Text}
)
To ensure you are not adding a duplicate you could include this check.
If(
IsBlank(LookUp(your_datasource_name, ColumnName1 = TextInput1.Text)),
Patch(
your_datasource_name,
Defaults(your_datasource_name),
{ColumnName1: TextInput1.Text}
)
)
Note: please replace all references with your own control names and SharePoint column names.
---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."
WarrenBelz
89
Most Valuable Professional
MS.Ragavendar
60
stampcoin
48