Hello @hotiday
Yes, you can use the code you prefer, including loops, conditional statements, and even calling third-party blocks of code. Please, describe the equation you are trying to implement and your code.
Best regards.
I am trying to implement the following function:
let i=1;
let data = 16;
let b = [];
for(i =1;i<data+1;i++){
let a = 10-0.0137039*i;
a = Math.exp(a);
b.push(a);
}
b = b.reduce((curr, more) => curr + more, 0)
however I don’t know where do I find a custom block of code able to do this!
-
This reply was modified 3 years, 7 months ago by
hotiday.
Hello @hotiday
You should select the calculated field and enter the following piece of code through its “Set equation” attribute:
(function(){
let i=1;
let data = 16;
let b = [];
for(i =1;i<data+1;i++){
let a = 10-0.0137039*i;
a = Math.exp(a);
b.push(a);
}
return b.reduce((curr, more) => curr + more, 0);
})()
Best regards.
And what if I wany to set data = fieldname12? Do I have to put it out of the parenthesis?
Hello @hotiday
Just replace the number 16 with the field name:
(function(){
let i=1;
let data = fieldname12;
let b = [];
for(i =1;i<data+1;i++){
let a = 10-0.0137039*i;
a = Math.exp(a);
b.push(a);
}
return b.reduce((curr, more) => curr + more, 0);
})()
Best regards.
Thank you very much, problem solved!