cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Yama_Vin
Advocate I
Advocate I

Issue with Text field using as combo-box

Hi, 

 

We are trying to create a PowerApp form for our SharePoint list and we are facing the below issue. 

 

There are two text fields in SharePoint list , Category and Sub-Category. When i create the powerapps form I converted this to a combo box. because, we want to create a new item when the data is not already present in the field if its already exist user can select from the dropdown list. 

 

I am able to create the new record, I can either select from the combo box list or I can type a new value and I can save. The problem I am facing is , When i try to edit a field value other field value is getting deleted. 

 

Ex: creating a new record with values Category = Test and Sub-Category= Test 1, if i try to update the Sub-Category value the Category value  is getting deleted. 

 

These are my codes: 

Item :- [listname].Category

Datacard Update :-  

If(
IsBlank(ComboBox1_1.Selected.Category),
ComboBox1_1.SearchText,
ComboBox1_1.Selected.Category
)

Combobox Defaultselected items:-

 

If(
SharePointForm1.Mode = FormMode.New,
{
'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Value: ""
},
{ /* <-- Modify here, type a record value rather than a Text value */
'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Value: ThisItem.Category
}
)

Can anyone please help on this ?  Appreciate your help

 

Thanks 

 

 

 

 

8 REPLIES 8
WarrenBelz
Super User
Super User

Hi @Yama_Vin ,

I think the reason is here

If(
   IsBlank(ComboBox1_1.Selected.Category),
   ComboBox1_1.SearchText,
   ComboBox1_1.Selected.Category
)

If ComboBox1_1.Selected.Category is blank, there is no SearchText so it will write a blank value back to your list.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

v-yutliu-msft
Community Support
Community Support

Hi @Yama_Vin ,

Do you mean that when you create a new record,  Category value will be cleared?

Could you show me the settings of Sub-Category field?

You only show me the settings of Category field, I do not find any place related to Sub-Category field.

Since Category  is text type, I do not think you need to set so complex. Try this:

Item :- listname

primary text: Category

Datacard Update :-  

If(
IsBlank(ComboBox1_1.Selected.Category),
ComboBox1_1.SearchText,
ComboBox1_1.Selected.Category
)

Combobox Defaultselected items: ThisItem

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-yutliu-msft , not sure why your repeated my post here.

@Yama_Vin - happy to continue this discussion when you confirm my assumption.

@WarrenBelz  Thanks ! 

 

In this case, combobox1_1 is not blank. This is what I am doing 

 

Step 1-  Creating a New Record with Category and Sub category . item is saved 

Step 2:   Editing the record, When I click edit button in SharePoint, Form will open with Category and Subcategory value.  Now,                    when i try to edit any field value and save, other field value is getting deleted. 

 

Sub Category Update -- 

 

If(
IsBlank(ComboSubCategory.Selected.Result),
ComboSubCategory.SearchText,
ComboSubCategory.Selected.Result
)

 

Category Update 

 

If(
IsBlank(CategoryCombo.Selected.Result),
CategoryCombo.SearchText,
CategoryCombo.Selected.Result
)

 

 

Thanks 

 

@v-yutliu-msft 

 

I am able to create new record and i can retrieve the data when opening . Problem is when I try to edit the record.  When I edit one field value other field value is getting deleted. 

 

Thanks 

Hi @Yama_Vin ,

Clearly the .SearchText reference is doing this and writing back a blank value. I will firstly say I have never used that property and the ComboBox reference does not mention it, but it would appear to me to be whatever is typed in the "search" field (which would be blank in your case). So for a start, try this

If(
   !IsBlank(ComboBox1_1),
   ComboBox1_1.Selected.Category
)

and this

If(
   !IsBlank(ComboSubCategory),
   ComboSubCategory.Selected.Result
)

Also if this does not fix the issue, please tag whoever you want to continue this thread with as I have found that three-way conversations do nothing but confuse everyone.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Hi @Yama_Vin ,

Just checking if you got the result you were looking for on this thread. Happy to help further if not.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

@WarrenBelz  

Thanks . I will try this let you know ,if this resolve my issue. 

 

Thank you @

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,456)