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

Use Checkbox to set value instead of DropDown

Hello all,

I have a DrowDown1 connected to a Datasource (SharePoint List).

The user should be able to check a CheckBox1 and when sending the form, instead of a value from the DropDown1, there should be "CheckboxValue" used (in the same coumn of the SharePoint list.

 

So far, I use OnCheck=Dropdown1Value.Selected.Value="CheckboxValue".

 

But it simply does not work and gives me an error when sending the form.

"An entry is required or has an invalid value. Please correct and try again."

 

Can anybody help?

2 ACCEPTED SOLUTIONS

Accepted Solutions
Super User
Super User

Re: Use Checkbox to set value instead of DropDown

@Frankie70 

Can you clarify a bit of your scenario?

I'm unclear as to exactly what you are trying to do from the data-side of things.

 

Are you stating that the user would:

A) Be able to choose a value in the DropDown list, and if so, that value would be updated to the datasource column

B) Be able to check a box on the form and the DropDown value would be ignored, but instead another column would be populated with "CheckboxValue"

C) Something completely different

 

The bottom line is - from the data side - unless your column will allow additional values, you will not be able to set the column to something that is not in it.  

You CAN have more values in your DropDown than exist in the data, but you will not be able to set the data column to other values not in that list (again, unless your column allows it)

Adding additional values to your DropDown Control is very common (as many want a "select all" or "select none" option).

 

So, again, if you could clarify a bit and perhaps provide a detailed scenario, that would help.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Super User
Super User

Re: Use Checkbox to set value instead of DropDown

Hey @Frankie70 

Yes, that's not going to work...there you are referencing the value of the combobox to lookup the value of the combobox...not what you want!

From what we've gone over, I believe that the "Insured Entity" column has the Title of the LegalEntitiesOrga value that you want in the ComboBox.  So, again, you need to reference that in your property:

   Lookup(LegalEntitiesOrga, Title=SharePointIntegration.Selected.'Insured Entity')

 

Try this formula and see if that moves you forward.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
38 REPLIES 38
Super User
Super User

Re: Use Checkbox to set value instead of DropDown

@Frankie70 

You cannot specifically set a value of a control like that.  Instead you would want your control to consume the value from the checkbox.

 

So, instead of putting the formula you have on the CheckBox, put the formula on the DropDown.

Dropdown Default property : If(CheckBox1.Value, "CheckboxValue")

 

This assumes a couple of things:

1) You are referring to a DropDown and not a ComboBox control. 

2) Your "CheckboxValue" is a valid item in your DropDown Control.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Frankie70
Level: Powered On

Re: Use Checkbox to set value instead of DropDown

@RandyHayes 

Thank you for you reply.

 

My CheckBoxValue is not in my DropDownList Smiley Sad

I wanted to use it like this because the users should be able to quickly choose a value (CheckBox1) that ist completly different to the values (~200) in the DropDownList.

Have you any ideas how I could do that?

Restriction: I can not add another value to the DropDownList.

 

best regards!

Community Support Team
Community Support Team

Re: Use Checkbox to set value instead of DropDown

HI @Frankie70 ,

Do you want the field in your Edit form to use the "CheckboxValue" rather than Dropdown value when the Checkbox is checked?

 

Based on the formula that you mentioned, I think there is something wrong with it. Currently, within PowerApps, we could not set a control's property value in another control.

 

I have made a test on my side, please take a try with the following workaround:

Within your Edit form, set the Update property of the Data card (which would reference values from Dropdown1 or Checkbox) to following:

If(
    CheckBox1.Value,             /* CheckBox1 represents the CheckBox control in your app */
   "CheckboxValue",
    Dropdown1.Selected.Value
)

10.JPG

 

Best regards,

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

Re: Use Checkbox to set value instead of DropDown

@Frankie70 

Can you clarify a bit of your scenario?

I'm unclear as to exactly what you are trying to do from the data-side of things.

 

Are you stating that the user would:

A) Be able to choose a value in the DropDown list, and if so, that value would be updated to the datasource column

B) Be able to check a box on the form and the DropDown value would be ignored, but instead another column would be populated with "CheckboxValue"

C) Something completely different

 

The bottom line is - from the data side - unless your column will allow additional values, you will not be able to set the column to something that is not in it.  

You CAN have more values in your DropDown than exist in the data, but you will not be able to set the data column to other values not in that list (again, unless your column allows it)

Adding additional values to your DropDown Control is very common (as many want a "select all" or "select none" option).

 

So, again, if you could clarify a bit and perhaps provide a detailed scenario, that would help.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Frankie70
Level: Powered On

Re: Use Checkbox to set value instead of DropDown

@RandyHayes

 

Scenario A) and B).

I found a workaround for that.

I created a sepearte DropDown Control linked to the lexternal ist and a CheckBox that populate a column filed in my SharePoint List. Whenever the CheckBox is checked, the DropDown is invisible and the Value of the CheckBox is taken. That works great.

 

But I have another issue.

When I want to add a new item in my SharePoint List, some fields are already filled out in the form.

In SharePointIntegration--> Advanced Settings--> OnNew 

I have the follwing:

Set(SharepointFormMode, "CreateForm");NewForm(SharePointForm1); Navigate(FormScreen1, ScreenTransition.None); ResetForm(SharePointForm1);Reset(ComboBox1);Reset(Checkbox1);Reset(DataCardValue3).

 

I have no idea if thsi is correct or not. I want the form to be empty when pressing +New in the SharePoint List.

 

On the other Hand I would like that when clicking on an item, the ViewForm would have the values and when I click on Edit the values would alread be in the form, too.

 

Can I achieve this using just one FormScreen?

 

 

Super User
Super User

Re: Use Checkbox to set value instead of DropDown

@Frankie70 

Yes, this can all be done in one screen as you suggest.  

In general, a ViewForm is a static form that has very little ability to do more than view.  An EditForm, on the other hand, can edit/new and view.

The trick is to work with the Default and Update properties of the data cards to give you what you want.

Basically - the Default property determines what will be seen by default when the Form is shown.  The Update property will determine what actually gets stored when you submit.

You can govern the mode of the Form by setting the DisplayMode property of the entire form.

 

You can take a look at the docs on the properties for the data cards for some more detail if needed.

 

I hope that adds some more information for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Frankie70
Level: Powered On

Re: Use Checkbox to set value instead of DropDown

@RandyHayes 

 

Hi,

 

this works great.

  1. But I have this checkbox, its default-value is "blank" (nothing). When clicking on "New" it is not checked (which is correct) but in the background the variable 'varCheck' is still set to true from the previous entry in the form. How can I reset the variable 'varCheck' to false, when I click "New". I tried set(varCheck, false) in OnNew in Action section of the SharePointIntegration Adavnced Settings. But thes does not work.
  2. I have got the behaviour that the last item in the SharePoint list gets overwritten with the new one.

 

Frankie70
Level: Powered On

Re: Use Checkbox to set value instead of DropDown

@RandyHayes 

I just solved 2.):

In the SharePointIntergration settings I removed some entries in "OnNew".

Now, what is left is the following:

Set(SharepointFormMode, "CreateForm");NewForm(SharePointForm1); Navigate(FormScreen1, ScreenTransition.None)

 

I am really not sure if all that is correct or what should be put into this field.

Frankie70
Level: Powered On

Re: Use Checkbox to set value instead of DropDown

@RandyHayes 

seems like I am on a winning streak.

Got it all for the New Form.

 

Maybe you can give me a hint how I change the current form, so that when I cklick on an item in the SharePoint list, the values will be displayed in the form.

Currentely, nothing is displayed. Seems a bit that the settings of the New Form have been taken.

 

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

Follow PowerApps on Twitter

Stay Up-to-Date by following PowerApps on Twitter

Top Community Contributors for July 2019

Top Community Contributors for July 2019

Let's thank our top community contributors

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

FifthImage

Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!

Users Online
Currently online: 41 members 4,122 guests
Recent signins:
Please welcome our newest community members: