if statement to set two variables

Hello @hheyhey568

No, I’m sorry, the equation is incorrect.

You should use commas between variables in the declaration section (var) only. Furthermore, if multiple instructions belongs to an if conditional statements, you must create blocks with the {} symbols.

The conditions in your second if conditional statements are just the same of the first one AND(variable1=="Material1",variable2=="class1"), so, you should assign every value in a unique if block:


(function(){
var variable1 = fieldname1, variable2 = fieldname2, variable3 = fieldname3, variable4 = fieldname4;

if(AND(variable1=="Material1",variable2=="class1"))
{
 variable3=100;
 variable4=150;
 variable5=120;
 variable6=200;
}

getField(5).setVal(variable3);
getField(6).setVal(variable4);
getField(7).setVal(variable5);
getField(8).setVal(variable6);

})()

If you want to generate a table with variable3 vs variable4, and variable5 vs variable6. You can use the calculated field as an auxiliary field and display the results into an “HTML Content” field.

You can insert an “HTML Content” field with a div tag as its content where display the table:

<div class="table-here"></div>

And the equation would be:


(function(){
var variable1 = fieldname1, variable2 = fieldname2, variable3 = fieldname3, variable4 = fieldname4, table;

if(AND(variable1=="Material1",variable2=="class1"))
{
 variable3=100;
 variable4=150;
 variable5=120;
 variable6=200;
}

getField(5).setVal(variable3);
getField(6).setVal(variable4);
getField(7).setVal(variable5);
getField(8).setVal(variable6);

table = '<table><tr><td>'+variable3+'</td><td>'+variable4+'</td></tr>'+
        '<tr><td>'+variable5+'</td><td>'+variable6+'</td></tr></table>';

jQuery('.table-here').html(table);
})()

Regarding the charts, my apologies, it is a commercial feature, and we are not allowed to support any customers in these forums.

For pro or commercial product support please contact us directly on our site. This includes any pre-sales topics as well.

Commercial products are not supported in these forums. We will happily answer this and any other questions you can have on our own site.

Thank you.
Best regards.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Your Advertisement Here