I want to make make the element near the KELOMPOK UMUR to display the Age range based on the TOTAL value (in number). The TOTAL is the SUM of item No. 1- No. 6 value.
for example, if the TOTAL is 12-24 then, the age range is 4;0 - 4;5. But the problem is I don’t know how to do the conditioning between different elements. I have tried using the set state (see Image 2) but it does not work.
Are the conditionals not working because the place where you calculate the total (SARINGAN TOTAL) is a text element?
How to solve it:
Indeed, you could use a page state to store the value and do your conditionals based on that. (don’t forget to set the state’s type to a number).
switch that SARINGAN TOTAL element from text to input element. Do the calculation from there. Yes, you can “dress it up” to look like a plain text element.
If you’re a wild type , you can calculate the KELOMPOK UMUR on a text field by chaining :formatted as text. Surely not sustainable, but fun:
[your whole calculation] > 14 :formatted as text
if yes: 4;0 - 4;5
if no: [your whole calculation] ≥ 16.4 :formatted as text
if yes: 4;5 - 5;0
if no: [your whole calculation]...
The problem indeed is because the elements where I do the calculation is text, so when I changed it to input( type: integer) i was able to do the calculation.
Thank you @rico.trevisan for your help. You are a legend! I appreciate your help, i hope you have a good day.