Hello @m0z4r
If you want to display some fields based on the choices selected in a dropdown field, radio buttons, or checkbox fields, you can define dependencies. Please, read the following blog post:
https://cff.dwbooster.com/blog/2020/03/01/dependencies
To transform some numbers into others, you have multiple alternatives. For example, you can use conditional statements in the equations, like:
(function(){
switch(fieldname1)
{
case 1: return 260;
case 2: return 720;
case 3: return 5080;
}
})()
Or if these choices are selected through a dropdown field, you can enter the numbers 1, 2, 3, … as the choices texts and the numbers 260, 720, 5080, as their corresponding choices’ values.
Best regards.
-
This reply was modified 4 years, 6 months ago by
codepeople.
Thread Starter
m0z4r
(@m0z4r)
ok thank you very much, to make it simple and for you to understand better, I want to do as in the field : Legendary Commander EXP Required
From level
1
To level
2
EXP Required
120
on this page https://www.rok.guide/calculators/tomes-of-knowledge/
so box 1, gives a number 1 which is equal to zero
box 2 gives a number that is equal to 120
so 1=0, 2=120, 3=480
and the third box is used to calculate the difference between box 1 and 2
for example if the box 1 is equal to “2” so “120”, and the box “2” is equal to 3 so “480
square 3 will give the result “360”.
Hello @m0z4r,
In this case, you can include an object as part of the equation and sum its attributes’ values. For example, assuming the “From level” and “To level” are the fields fieldname1 and fieldname2. The equation can be implemented similarly to:
(function(){
var result = 0,
obj={
1: 260,
2: 720,
3: 5080
};
for(var i=fieldname1; i<=fieldname2; i++)
{
result += (i in obj) ? obj[i] : 0;
}
return result;
})()
Best regards.
Thread Starter
m0z4r
(@m0z4r)
thank you very much it’s almost but there is a mistake it adds up everything,
if I measure between 1 and 1 it gives: 260 so it’s ok
then between 1 and 2 it gives : 980 (260+720) when it is supposed to give 460 (720-260)
that is to say always the difference between the first square and the second, actually the equation that you gave me adds 260+720, my goal is that it gives only the distance between one and the other .
Hello @m0z4r
If you want the difference between the two numbers the equation can be implemented as follows:
(function(){
var obj={
1: 260,
2: 720,
3: 5080
};
return ABS(((fieldname1 in obj) ? obj[fieldname1] : 0) - ((fieldname2 in obj) ? obj[fieldname2] : 0));
})()
Please, note the support service does not cover the implementation of the users’ projects (forms or formulas). If you need someone that implement your project, you contact us directly through our website: Click Here
Best regards.
Thread Starter
m0z4r
(@m0z4r)
ok it works perfectly now thank you very much, it is a support of real quality and very fast. I am looking to understand some mechanics of the program for future project and really very happy with the support you have given me. I will surely contact you to improve the design of my calculator for my site, again thank you very much you are awesome.