Hello @cncladmin,
I’ve visited the URL provided but the form is not there.
Please, configure your calculated field as follows:
1. Enter the comma symbol (,) into the attribute: “Symbol for grouping thousands”
2. Enter the text: whole meals into the attribute: “Symbol to display at the end of calculated field”
3. Finally, edit the equation as follows:
(function(){
if(fieldname11=="Vegan") return ROUND((fieldname3*365+fieldname2*30+fieldname8)*6.32);
if(fieldname11=="Lacto-ovo Vegetarian") return ROUND((fieldname3*365+fieldname2*30+fieldname8)*5.14);
})();
and that’s all.
Best regards.
Thanks for your very quick reply.
Your solution works great for this particular field; however, I have other fields that have a slightly more complicated equation, and it doesn’t appear that this solution will work for those, which are all similar to the following:
(function(){
if(fieldname11==”Vegan” && fieldname12==”Metric”) return ROUND(((fieldname3*365)+(fieldname2*30)+fieldname8)*2.488)+” kg”;
if(fieldname11==”Lacto-ovo Vegetarian” && fieldname12==”Metric”) return ROUND(((fieldname3*365)+(fieldname2*30)+fieldname8)*1.531)+” kg”;
if(fieldname11==”Vegan” && fieldname12==”Imperial”) return ROUND((((fieldname3*365)+(fieldname2*30)+fieldname8)*2.488)*2.2)+” lb”;
if(fieldname11==”Lacto-ovo Vegetarian” && fieldname12==”Imperial”) return ROUND((((fieldname3*365)+(fieldname2*30)+fieldname8)*1.531)*2.2)+” lb”;
})();
…this is because the “symbol to display at the end of the field” is different depending upon the conditions (“lb” vs. “kg” depending upon whether the person selected “imperial” or “metric”). Do you know how I can insert the thousands separators into these figures while still allowing for the conditional “display at the end of the field.”
…btw, I apologize for not giving more info on the url. To see the table, go to the bottom of this page: http://cncl.org.nz/plant-based/
Thanks,
Paris
Hello @cncladmin,
The solution in this case would be call one of methods of the plugin to format the number before concatenate the text.
Leave in blank the attributes in the field’s settings, and then, edit the equation as follows:
(function(){
var format = fbuilderjQuery.fbuilder.calculator.format,
config = {groupingsymbol:',', decimalsymbol:'.'};
if(fieldname11=="Vegan" && fieldname12=="Metric") return format(ROUND((fieldname3*365+fieldname2*30+fieldname8)*2.488), config)+" kg";
if(fieldname11=="Lacto-ovo Vegetarian" && fieldname12=="Metric") return format(ROUND((fieldname3*365+fieldname2*30+fieldname8)*1.531), config)+" kg";
if(fieldname11=="Vegan" && fieldname12=="Imperial") return format(ROUND((fieldname3*365+fieldname2*30+fieldname8)*2.488*2.2), config)+" lb";
if(fieldname11=="Lacto-ovo Vegetarian" && fieldname12=="Imperial") return format(ROUND((fieldname3*365+fieldname2*30+fieldname8)*1.531*2.2), config)+" lb";
})();
Best regards.
Perfect! Thanks so much,
Paris