Zoho Creator Deluge - dynamically change fields depending on user input of field1 or field2

Zoho Creator Deluge - dynamically change fields depending on user input of field1 or field2

Hi everyone and happy holidays!

 

Hope that someone will help me figure out a solution to my problem…

In my form there are currency, formulas and lookup fields.

 

I’m well aware, that formulas fields if marked visible on form, cannot be hidden anywhere (like in subforms) unless you use a workaround (like put it in a section and hide the section).

But I can’t manage them in section and don’t want them to show especially for users that are not admin so I found a workaround: for each formula field I create a corresponding currency field that will get populated with the formula field value via deluge. The formula fields stays hidden and the solution works properly for my needs.

 

But now I need to complicate it a little.

Fields:

Value with taxes  – currency – initial value 0.00

Taxes – look up field

Value without taxes – currency  – initial value 0.00

Calculate amount without taxes from Value with taxes – formula

Calculate amount with taxes from Value without taxes – formula

 

My situation:

When filling the form the user will know and input the Value with taxes or the Value without taxes or none.

If he fills the Value without taxes I want the Value with taxes to populate and vice-versa

So, I thought I could write a Create/edit on user input of field per each Value without taxes and Value with taxes with if statement. Each one separately works fine, but if I enable both when I add one of the Value fields the form fields will experience a continuous loop.

 

Let’s say for example the first simple code I tried

  1. //On Create/Edit on User Input of Value with taxes

    //check if the other field is not empty. Had to check bc it could be in edit

    if(input.value_without_taxes != 0 || input.value_without_taxes == null)

    {

                   //hope this will clear the other field

                   input. input.value_without_taxes = 0;

    }

    //now that allegedly is cleared I assign the value of the formula field

    input.value_without_taxes = input.formula_without_taxes;

 

Enabled alone the workflow is good but when I enable the twin for the Value without taxes it does change the values based on what field the user updates but goes into a loop (it shows the “round gif” on the side of the fields).

Hope someone can show me what I’m doing wrong (I thought about using Fetch but I’m not quite sure) and maybe tell me the correct and “nicer” way of writing this snippet.

Thanks

Ellie