cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Post Prodigy
Post Prodigy

Patch to ComboBox with multiple values

Hi Folks -

 

I'm trying to patch a record from one list to another list.  The unfortunate thing is, one of the fields I am trying to patch to has 20 values.  Is there a way to get the value from the source list and then scan the target ComboBox box for the value and return the ID, set as a variable and then use that in my Patch command?

 

Otherwise, i was thinking making a formula to check value I'm using in my Patch and set the appropriate ID into a variable  So for instance, instead of Id=1 I'd use Id=varValue.

 

Patch(rdInvestments,{Device_Flag:{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",Id:1,Value:"TRUE"},ProjectCode:"TEMPNAME"})

 

 

The only issue is if I add a new Choice value, I need to update the formula.  I'm hoping there is a way to get the ID dynamically. Any thoughts?  Thanks!

 

3 REPLIES 3
Anonymous
Not applicable

A combobox with single item selection stores as a record: 
{Value: <Value>}
A combobox multiple select stores as a table: 
[Id: <Id>, Value: <Value>,Id: <Id>, Value: <Value>,...]

So you can get the items from source combobox in a table variable, update it with new values if required, and while patching, provide this table as source in the formula. 

Eg: 

Patch(rdInvestments,{Device_Flag:source_table});

Hope this gives you a hint to solve your issue. 

@Anonymous  Hmmm, I'm not really following.  Let me explain.

 

Powerapps is my Master Data Management Platform where users enter New and Change Requests to existing data elements that are importing into our Financial Applications.

 

For Change Requests, the EditForm opens and depending on what field they change, I need to update another SP list as a couple of our data elements are linked as one represents early discovery while one represents development.  The field I am changing has the same list of values as the field I'm trying to update in the other form and they are named the same as well.

 

The field has 20 values. Let's say I made a new single Selection to "Value6" and now I want to update the target field with the same "Value6".  How do I dynamically get the ID of 6 (or whatever it is) so I can patch to the Target?  As based on my research, I need both the ID and the actual value to patch.

 

I was thinking making an If statement to say if value = "Value6" then Set(strIDValue,"6") and then use that variable for the Id portion of the Patch logic...I was hoping there was a more dynamic way.

Here is an example of what I'm trying to do. Source and Target represent my SharePoint lists.  Note, I already have the logic to join the records to ensure I'm updating the correct one.

example.png

 

Field_Example Values
Alligator1
Cat2
Bird3
Dog4
Deer5
Moose6

 

 And then here would be my logic...So my question is, how do I get "6" dynamically?  And obviously, "Moose" will be represented by a DataCardValueXX.Text logic. I have it hard coded here only for example purposes.

 

Patch(
	rdInvestments,
	LookUp(rdAssets, Research_Code=Right(DataCardValue100.Text),
		{Device_Flag:{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
			Id:6,Value:"Moose"}}
);

 

 

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (74,141)