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

Clear DefaultSelecteditems of a ComboBox When Selection Changes. Assume this would be in OnChange Event?

Form is for Editing a Matter 

The form's Default mode is edit. The Forms Item property is set to the Selected Gallery Item...GalMatters.Selected

There are a serires of datacards that are foreign keys in a table

 

Here is an example of one of the Data Cards.

 

This is for Probation Officers

 

The DataCard field  is a foreign key in the form's table...tblMtr.  The field is MtrPro1

The DataCardValue's Default Value is set to a combo box selected item.....cmboMtrEditPro.Selected.ProID

The ComboBox Default selected items is set to the DataCard fields value Filter('[dbo].[tblPro]',proID = MtrPro1)

 

Accordingly, When Someone selects a matter in the GalMatter Gallery the Edit form populates the combo boxes with the record corresponding with the foreign key.   

 

All well and good.  The rub is when you want to change the selection from Probation officer Joe Smith to Jane Doe.  When you submit the form the Default for the DataCard goes back to the DefaultSelectedItems.  

 

Its essentially circular.  Is there a method for the OnChange event that would clear the DefaultSelectedItems for the combo box. 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Clear DefaultSelecteditems of a ComboBox When Selection Changes. Assume this would be in OnChange Event?

Hi @tflynn5005 ,

Do you want to write a null value to a foreign key field?

Could you describe more clearly about the field's name?

I assume that the form is binding with the tblMtr table, MtrPro1 is the foreign key.

                       the other table's name is tblPro, proID is the primary key.

Sine the primary key can't be null value, so you can't filter a record if the MtrPro1 is null value by using this formula: Filter('[dbo].[tblPro]',proID = MtrPro1)

 

I suggest you use the if statement.

If(IsBlank(assignement.Text),[],Filter('[dbo].[tblPro]',proID = MtrPro1))

 

Best regards,

Community Support Team _ Phoebe Liu

 

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.

View solution in original post

3 REPLIES 3
tflynn5005
Level: Powered On

Re: Clear DefaultSelecteditems of a ComboBox When Selection Changes. Assume this would be in OnChange Event?

UPDATE*****

Correction this works as designed.  YOu can change to Jane Doe.  The hang up is when you want to change the assignement to a null i.e. no assinged Probation Officer.  It reverts back to the default.  So how do you write a Null to the SQL AZURE table??? the columns property in SQL Azure Allow Nulls is set to yes so it is not a back end issue.  I'm Stumped.  

Community Support Team
Community Support Team

Re: Clear DefaultSelecteditems of a ComboBox When Selection Changes. Assume this would be in OnChange Event?

Hi @tflynn5005 ,

Do you want to write a null value to a foreign key field?

Could you describe more clearly about the field's name?

I assume that the form is binding with the tblMtr table, MtrPro1 is the foreign key.

                       the other table's name is tblPro, proID is the primary key.

Sine the primary key can't be null value, so you can't filter a record if the MtrPro1 is null value by using this formula: Filter('[dbo].[tblPro]',proID = MtrPro1)

 

I suggest you use the if statement.

If(IsBlank(assignement.Text),[],Filter('[dbo].[tblPro]',proID = MtrPro1))

 

Best regards,

Community Support Team _ Phoebe Liu

 

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.

View solution in original post

Administrator
Administrator

Re: Clear DefaultSelecteditems of a ComboBox When Selection Changes. Assume this would be in OnChange Event?

Hi @tflynn5005 can you review the above reply and update the thread if it was helpful? 

 

Thank you,

 

@TopShelf-MSFT 

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 283 members 6,619 guests
Please welcome our newest community members: