How can i make a conditional logic between two different elements?

Hello everyone!

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.

Any help will be appreciated!

image 1


Image 2


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 :tiger2:, 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]...

This looks very helpful, i will try this.
THANKS A LOT👍

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.

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.