Hi All,
I would like to set a numerical value to a check box (yes/no), if the check box is selected, it's added to the total at the bottom of the form.
For example, here is a screenshot of my form. The values next to the check box's are the value I want to assign per check box.
The values at the bottom will reflect the total value added up (this field is a text box field in my SP data source).
Also, when the form is filled in, I would like the values to be a running total. When I save the form, I would like these total values written back to the SP List.
Anyone have any advice on this or dome something similar in the past?
Solved! Go to Solution.
Since the first column is set to 0 your can ignore it and set the Default value of the textinput box to 0. For the other columns, create 3 UpdateContext variables one for each column to be used in the OnCheck and OnUncheck properties of the checkboxes, In the second column, for example, make the OnCheck property of each checkbox in the column, UpdateContext({var1:var1+4}) and set the format of the textinput boxes to Number and the Default property to var1.
Similarly for column 3, UpdateContext({var2:var2+5) and for column 4, UpdateContext({var3:var3+7). Likewise, set the Default for the textboxes, for column 3 and column 4, to var2 and var3 respectively.
Also set the Uncheck property of each checkboxes in the second column to UpdateContext({var1:var1-4}), and so on for the other columns.
Once you successfully save the data, you will need to reset all the checkboxes and set all the variables back to zero. ie. UpdateContext(var1:0}) and copy all these resets to the OnVisible property of your form.
Also I would make the DisplayMode property of each textinput box DisplayMode.Disabled to prevent the user from changing the value in the box.
If you wanted to, you could also display the total score in a label Sum(var1,var2,var3)
Since the first column is set to 0 your can ignore it and set the Default value of the textinput box to 0. For the other columns, create 3 UpdateContext variables one for each column to be used in the OnCheck and OnUncheck properties of the checkboxes, In the second column, for example, make the OnCheck property of each checkbox in the column, UpdateContext({var1:var1+4}) and set the format of the textinput boxes to Number and the Default property to var1.
Similarly for column 3, UpdateContext({var2:var2+5) and for column 4, UpdateContext({var3:var3+7). Likewise, set the Default for the textboxes, for column 3 and column 4, to var2 and var3 respectively.
Also set the Uncheck property of each checkboxes in the second column to UpdateContext({var1:var1-4}), and so on for the other columns.
Once you successfully save the data, you will need to reset all the checkboxes and set all the variables back to zero. ie. UpdateContext(var1:0}) and copy all these resets to the OnVisible property of your form.
Also I would make the DisplayMode property of each textinput box DisplayMode.Disabled to prevent the user from changing the value in the box.
If you wanted to, you could also display the total score in a label Sum(var1,var2,var3)
Hi @Drrickryp
Thanks for that. I am working through your solution now but it's taking me time, each column has 22 lines...
One quick question though, if I reset the variable with the OnVisible property of the form, will that also reset when a form is opened for editing? Would it be wise to use something like If(NewForm... for the variable reset?
That would depend on how you are saving your data. As I am envisioning your form, the checkboxes are not connected to the datasource and are only used for calculation. The saved data is the sum in each textbox at the bottom of each column. You are correct in being concerned about how it is displayed in an edit mode. You could show it as a label such as "Current value "&Parent.Default. and then if the user decides to change the value, they would tick the checkboxes to create a new sum that could be saved. In the New mode of the form, the Parent.Defaults would be blank.
Hi @Drrickryp
The check boxes are indeed connected to the SP list. This form is a (tool) to monitor progression and even though the score at the bottom does have a meaning to us, also being able to see progression from red to green on a certain line also helps us identify certain areas where staff may need help.
I'm still building out the form in both Detail and Edit views - I'll have an experiment with the OnVisible and shout up if I need more guidance.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
179 | |
47 | |
46 | |
34 | |
33 |
User | Count |
---|---|
258 | |
87 | |
78 | |
68 | |
67 |