cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
LTEVA
Regular Visitor

Patching combobox serchtext

Hello community,

 

i need some asistance on how to achieve the below:

What i have:

  • a Form(new) that updates an SP list called "Main List"
  • a Combobox in this form that shows items from another  Sharepoint "Model" list.

What i try to achieve is that IF the model entered in the combobox's  search-text is not included or being displayed as option, then this model should be patched to the SP "Model" List AND of course saved in the list item being created on the "Main List".

 

Thanks everybody and take care.

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-qiaqi-msft
Community Support
Community Support

Hi@LTEVA,

Based on the issue that you mentioned, do you want to patch the search text to  "Model" list and update it to "Main List"?

Could you please tell me that:

  1. what the column type that you fill the Combo Box, a Choice from "Model" list or a Lookup in the "Main List"?
  2. is this a custom form that you created using controls one by one?

If the column you fill the Combo Box is a Lookup column type, I think there is no way to patch the SearchText to neither the "Model" list nor  "Main List". The reason is that the Lookup column needs a record rather than a value when patching and the Id defines that the item you want to patch surely exists in the list where you created a Lookup column.

In a word, you could not patch the SearchText in a Combo Box that filled with a Lookup column.

As an alternative solution, I think you could try a collection which costs some time but it could solve your problem at some degree.

Create a new SP list and create columns as they are in the Main list, make sure that change the column that you fill the Combo Box into a Text type rather than a Lookup.

In my scenario, I have a SP list named 'tSheet2', a Text column named Teammate and a Lookup column named 'shared status'.

Collect your Main list as below:

 

Collect(Test,tSheets2)

 

Format the collection to get access to the value of the Lookup column and keep the value only as below:

 

Collect(Test1,ShowColumns(AddColumns(Test,"Shared",'shared status'.Value),"Teammate","Shared"))

 

Save the collection to the new SP list as below:

Collect(Test1,ShowColumns(AddColumns(Test,"Shared",'shared status'.Value),"Teammate","Shared"));ForAll(Test1,Patch('NewMainList',Defaults('NewMainList'),{NewColumn1:Teammate,NewColumn2:Shared}))

Add a Gallery5 to display all the records and set the OnSelect of the ">" as below:

Select(Parent);Navigate(Form1)

Add a Form1 to update the 'NewMainList' and a Combo Box outside it.

Set Item of the Form1 as below:

Gallery5.Selected

Set the Items property of the Combo Box as below:

Distinct('ModeList',Model)

Add a submit button to update the 'NewMainList':

Patch(NewMainList,Gallery5.Selected,{NewColumn2:If(ComboBox7.SearchText in Distinct('ModeList',Model).Result,ComboBox7.Selected.Result,ComboBox7.SearchText)})

Add a button to patch the new item to the ModeList.

Make it in edit mode only when the model entered in the combobox's search-text is not included

If(ComboBox7.SearchText in Distinct(ModeList,Model).Result,Disabled,DisplayMode.Edit)

It patches a new item to the ModeList when the model entered in the combobox's search-text is not included

Patch(ModeList,Defaults(ModeList),{Model:ComboBox7.SearchText})

Regards,

Qi

 

Best Regards,
Qi

View solution in original post

1 REPLY 1
v-qiaqi-msft
Community Support
Community Support

Hi@LTEVA,

Based on the issue that you mentioned, do you want to patch the search text to  "Model" list and update it to "Main List"?

Could you please tell me that:

  1. what the column type that you fill the Combo Box, a Choice from "Model" list or a Lookup in the "Main List"?
  2. is this a custom form that you created using controls one by one?

If the column you fill the Combo Box is a Lookup column type, I think there is no way to patch the SearchText to neither the "Model" list nor  "Main List". The reason is that the Lookup column needs a record rather than a value when patching and the Id defines that the item you want to patch surely exists in the list where you created a Lookup column.

In a word, you could not patch the SearchText in a Combo Box that filled with a Lookup column.

As an alternative solution, I think you could try a collection which costs some time but it could solve your problem at some degree.

Create a new SP list and create columns as they are in the Main list, make sure that change the column that you fill the Combo Box into a Text type rather than a Lookup.

In my scenario, I have a SP list named 'tSheet2', a Text column named Teammate and a Lookup column named 'shared status'.

Collect your Main list as below:

 

Collect(Test,tSheets2)

 

Format the collection to get access to the value of the Lookup column and keep the value only as below:

 

Collect(Test1,ShowColumns(AddColumns(Test,"Shared",'shared status'.Value),"Teammate","Shared"))

 

Save the collection to the new SP list as below:

Collect(Test1,ShowColumns(AddColumns(Test,"Shared",'shared status'.Value),"Teammate","Shared"));ForAll(Test1,Patch('NewMainList',Defaults('NewMainList'),{NewColumn1:Teammate,NewColumn2:Shared}))

Add a Gallery5 to display all the records and set the OnSelect of the ">" as below:

Select(Parent);Navigate(Form1)

Add a Form1 to update the 'NewMainList' and a Combo Box outside it.

Set Item of the Form1 as below:

Gallery5.Selected

Set the Items property of the Combo Box as below:

Distinct('ModeList',Model)

Add a submit button to update the 'NewMainList':

Patch(NewMainList,Gallery5.Selected,{NewColumn2:If(ComboBox7.SearchText in Distinct('ModeList',Model).Result,ComboBox7.Selected.Result,ComboBox7.SearchText)})

Add a button to patch the new item to the ModeList.

Make it in edit mode only when the model entered in the combobox's search-text is not included

If(ComboBox7.SearchText in Distinct(ModeList,Model).Result,Disabled,DisplayMode.Edit)

It patches a new item to the ModeList when the model entered in the combobox's search-text is not included

Patch(ModeList,Defaults(ModeList),{Model:ComboBox7.SearchText})

Regards,

Qi

 

Best Regards,
Qi

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,375)