cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
nchandran
Helper V
Helper V

Checkbox not updating Datacardvalue

Hi,

 

I have a checkbox when checked changes a particular text field datacardvalue in a form to "NA" and then when checkbox is unchecked sets to "".

This was working when i created a new canvas app and practised the code. however when i used the same concept on my app , the form text field says name isn't valid, identifier isn't recognised. 

 

 

 

Text Field is a Datacardvalue where default property is RT1

This is the code for the checkbox -> On check property: If(true, UpdateContext({RT1:"NA"})), On Uncheck property: If(true,UpdateContext({RT1:""})). Screenshots belows shows the parent Datacard default property and 2nd screenshot shows the datacardvalue default property .

 

nchandran_0-1627201139771.png

nchandran_1-1627201149863.png

 

 

 

 

 

 

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
Ramole
Memorable Member
Memorable Member

@nchandran 

 

Global variable will take care of that , lets troubleshoot by adding another new checkbox inside the form screen anywhere and add On check of the new checkbox the formula I will give you now , please do not modify the formula exempt the control name?

 

OnCheck

If(Checkbox4.Value, Set(varRTA,"NA"))

 

Uncheck

 

If(!Checkbox4.Value, Set(varRTA,""))

 

You will need to check Checkbox4 to the name of your new checkbox

 

Let me know 

 

 

 

Thank you
If this post helps, then please consider Accept it as the solution to help the others and consider giving it a "Thumbs Up."

View solution in original post

ok i created a new checkbox, this component is now called checkbox4. On check and uncheck property have been programmed with the codes you've mentioned. i realised the global variable needs to be applied to the datacard value and its works now. 

 

View solution in original post

32 REPLIES 32
Ramole
Memorable Member
Memorable Member

Hi @nchandran 

 

OnCheck Checkbox

 

 

 

 If(Checkbox3.Value, UpdateContext({RT1:"NA"}))

 

 

 

OnUnchecked Checkbox

 

 

 

 If(!Checkbox3.Value, UpdateContext({RT1:Blank()}))

 

 

 

If use your form for Edit and New Use this code on the Datacard Default

 

 If( YourFormName.Mode = FormMode.New,RT1,             ThisItem.EQUIPMENU)

 

Change Checkbox3  and YourFormName  whatever your control name  also RT1 add Default datacard EQUIPMENU the control you wanted to reset. to "NA"

 

Let me know if you need any more assistance 

 

 

Thank you
If this post helps, then please consider Accept it as the solution to help the others and consider giving it a "Thumbs Up."

Getting error.

1) For form Datacard default

nchandran_1-1627221163844.png

2) Checkbox error on formula

nchandran_2-1627221182760.png

 

Ramole
Memorable Member
Memorable Member

Hi @nchandran 

1- What is the name of your checkbox 

2- paste the code here 

 

 

 

Thank you
If this post helps, then please consider Accept it as the solution to help the others and consider giving it a "Thumbs Up."

1- What is the name of your checkbox : 138CheckboxBT

2- paste the code here 

on check property -> If(true, UpdateContext({RT1:"NA"}))
on Uncheck property -> If(true,UpdateContext({RT1:""}))

Card Default property
 If(138Form3.Mode = FormMode.New,RT1,ThisItem.EQUIPMENU)
Ramole
Memorable Member
Memorable Member

Hi  @nchandran 

 

Please fellow this as i see there's typo error on control names and make sure you use my formulas whole Not this If(true, UpdateContext({RT1:"NA"}))

, so lets rename your form name  FormLoans to same on the code 

 

 

 

If(FormLoans.Mode = FormMode.New,RT1,ThisItem.EQUIPMENU)

 

 

  

 

CaptureDETAILS.PNG

 

 

Checkbox OnCheck  copy the formula whole and paste OnCheck 

 

 

 

 If(Checkbox4.Value, UpdateContext({RT1:"NA"}))

 

 

 

CaptureCheck.PNG

 

 

Rename your checkbox to Checkbox4

 

 

 

 

 



Checkbox  - OnUncheck 

 

 

 

 If(!Checkbox4.Value, UpdateContext({RT1:Blank()}))

 

 

 

 

 

 

Captureuncheck.PNG

 

 

 

I have tested my end and its working here what I get

 

 

CapturecheckedNA.PNG

 

Let me know if you need any assistance 

 

Thank you
If this post helps, then please consider Accept it as the solution to help the others and consider giving it a "Thumbs Up."

Facing this error on the DataCard default property. Aren't we suppose to place this in the datacardvalue then the datacard? ok anyway its not working.

nchandran_0-1627271326528.png

 

Ramole
Memorable Member
Memorable Member

did you paste below codes to checkbox first as you will need Variable to be valid before the datacard RT1 to work 

 

 

Oncheck 

 If(Checkbox4.Value, UpdateContext({RT1:"NA"}))

 

Uncheck

 If(!Checkbox4.Value, UpdateContext({RT1:Blank()}))

 

Then add the Datacard the 

If(FormLoans.Mode = FormMode.New,RT1,ThisItem.EQUIPMENU)

 

Thank you
If this post helps, then please consider Accept it as the solution to help the others and consider giving it a "Thumbs Up."
Ramole
Memorable Member
Memorable Member

@nchandran 

 

Did you add this code to checkbox? first and make sure you name the checkbox Checkbox4 

 

 

If(Checkbox4.Value, UpdateContext({RT1:"NA"}))

 

Thank you
If this post helps, then please consider Accept it as the solution to help the others and consider giving it a "Thumbs Up."
Ramole
Memorable Member
Memorable Member

@nchandran 

 

I Did not ask this where is the checkbox placed, same screen where the Form is,  or in a different Screen ?

 

If its same screen use same code I give you before.

 

If NOT then you will need a variable global in other words, a variable that is visible from all other screens within your app so we will need to modify our old formula.

 

CheckBox   -  OnCheck

 

  If(Checkbox4.Value, Set(RT1,"NA"))

 

 

 

CheckBox   -  Uncheck

 

 

 If(!Checkbox4.Value, Set(RT1,Blank()))

 

 

 

DataCard 

 

 

If(FormLoans.Mode = FormMode.New,RT1,ThisItem.EQUIPMENU)

 

 

Thank you
If this post helps, then please consider Accept it as the solution to help the others and consider giving it a "Thumbs Up."

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,217)