Help Highlighting a table cell based on two table row values

  • 1
  • Question
  • Updated 1 year ago
  • Answered
  • (Edited)
I am using the snippet below to highlight table cell values based on the value of that cell. Is it possible to extend the if statement to also look at another set of values from a different table column? 

so if value === "my value" AND value2 === "my value2"


var field = arguments[0],    value = arguments[1],
   $ = skuid.$;
    
if(field.metadata.accessible){
    if(value === "MQL - Customer/W Oppty"){
        //RED 
        field.element.css({'background-color':'#ff0000','min-height':'10px','text-align':'center'});
    }
    if(value === "Passed to Sales"){
        //GREEN 
       field.element.css({'background-color':'#00cc00','min-height':'10px','text-align':'center'});
    }
    else if(value === "Qualifying" ){
        //YELLOW 
       field.element.css({'background-color':'#ffff00','min-height':'10px','text-align':'center'});
    }
     skuid.ui.fieldRenderers[field.metadata.displaytype][field.mode](field,value);
Photo of Josef Lagorio

Josef Lagorio

  • 2,864 Points 2k badge 2x thumb

Posted 1 year ago

  • 1
Photo of Bill McCullough

Bill McCullough, Champion

  • 12,436 Points 10k badge 2x thumb
Josef,

You can get the other field's value using something like this:
 (field.model.getFieldValue(field.row,'my_value2__c',true) 

Your 'if' would look like:
if(value === "Passed to Sales" && (field.model.getFieldValue(field.row,'my_value2__c',true)) { 

Look here for an example of a custom field render that calculates a total:

https://community.skuid.com/skuid/topics/row_action_with_inline_snippet_to_update_field

Thanks,

Bill