cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
el
Level: Powered On

combobox value in gallery to update sql record does not update to blank if cleared

I have an equipment scheduling app with a gallery using sql data source.  Several fields in each record use combo boxes to select pieces of equipment, location, etc.  OnChange uses UpdateIf to update the sql data source records.  That is working fine. 

 

However, if I clear the value in combo box, it does not update the SQL field value in the record to <blank>, but retains the value previously selected.  The combo value on the screen shows nothing selected, but the original value in sql field is retained.

OnChange action:

UpdateIf('[dbo].[schedule_trans]',ThisItem.sched_trans_id=sched_trans_id,{equipment_no1:cmbEquip1.Selected.equipment_no})

 

It works to assign/re-assign values but does not do anything if you clear the selected value.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: combobox value in gallery to update sql record does not update to blank if cleared

Hi @el 

 

Try checking when you clear the combox box

 

cmbEquip1.Selected.equipment_no - would probably be blank? - add a label contro and set its text to cmbEquip1.Selected.equipment_no and see the value in it

 

Additionally you can also check,

if(IsBlank(cmbEquip1.Selected.equipment_no),UpdateIf('[dbo].[schedule_trans]',ThisItem.sched_trans_id=sched_trans_id,{equipment_no1:""}),UpdateIf('[dbo].[schedule_trans]',ThisItem.sched_trans_id=sched_trans_id,{equipment_no1:cmbEquip1.Selected.equipment_no}))

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

2 REPLIES 2
Super User
Super User

Re: combobox value in gallery to update sql record does not update to blank if cleared

Hi @el 

 

Try checking when you clear the combox box

 

cmbEquip1.Selected.equipment_no - would probably be blank? - add a label contro and set its text to cmbEquip1.Selected.equipment_no and see the value in it

 

Additionally you can also check,

if(IsBlank(cmbEquip1.Selected.equipment_no),UpdateIf('[dbo].[schedule_trans]',ThisItem.sched_trans_id=sched_trans_id,{equipment_no1:""}),UpdateIf('[dbo].[schedule_trans]',ThisItem.sched_trans_id=sched_trans_id,{equipment_no1:cmbEquip1.Selected.equipment_no}))

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

el
Level: Powered On

Re: combobox value in gallery to update sql record does not update to blank if cleared

Thank you, thank you.

I was checking the combo value as you suggested, and I tried several variations of If(Blank(...),...,...) with Patch and UpdateIf, but I wasn't getting it to work.  Your UpdateIf statement did the trick.

 

Helpful resources

Announcements
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 392 members 4,497 guests
Recent signins:
Please welcome our newest community members: