Custom Field Renderer - To do Simple Calculations

Ah yes - I ran into this problem a week or so ago trying to build a dashboard. (more on that coming in late October). Template fields do not allow math on the fly. So I either had to go to formula fields in Salesforce, or Javascript component tied to an inline resource. I took the hard path… Here is my javascript code - replace the ALL CAPS items with your values.

//COMPONENT NAME is what you put in the custom page element 'component type' property. skuid.componentType.register('COMPONENTNAME',function(element){ var $ = skuid.$; var m = skuid.model.getModel('MODELNAME'); //Name of your model var row = m.getFirstRow(); //Using an aggregate model that only returns one row. var field = row.FIELDNAME; //Field name from your aggregate model var MathValue = (field / 1000).toFixed(2); //Do your math here element.append( m.mergeRow(row,MathValue) ); }); 

Please note - this Javascript is provided without warantee. I’m a fellow beggar. A javascript developer could do much better.