All Apps and Add-ons

how can i return a multivalued content using table-cell-highlighting ?

sfatnass
Contributor

hi,

i use tabe-cell-highlighting to color some value.

but if i have a multivalued content
how can i return this as multivalued content or an array and.

     if (cell.field === 'myMultivalued'){
            var valueDx = String(cell.value)
            var separators = [ '\\,' ];
            var tokens = valueDx.split(new RegExp(separators.join('|'), 'g'));

            for(var i =0; i<tokens.length;i++){
                    var numbers = parseFloat(tokens[i].split(":")[1]);
                if(numbers <= 0.2){
                    $td.addClass('range-cell').addClass('range-severe');
                    break;
                }
            }

            $td.text(cell.value);
        }

this is the line to modify : $td.text(cell.value);

i tryed something like that : $td.array(cell.value); but it's wrong and i know it.

in the same way can i keep the original content after highlighting ?

thx

0 Karma
1 Solution

sfatnass
Contributor

i solved it with that:

 if (cell.field === 's_conDx'){
            var valueDx = String(cell.value)
            var html_content= "";
            var tokens =[];
            var separators = [ '\\,' ];    
            tokens = valueDx.split(new RegExp(separators.join('|'), 'g'));
            for(var i =0; i<tokens.length;i++){
                var numbers = parseFloat(tokens[i].split(":")[1]);
                                        if(numbers <= criticalval){
                            html_content = html_content+"<div tabindex=\"0\" class=\"multivalue-subcell\" style=\"color:#E80C0C;\" data-mv-index=\""+i+"\">"+tokens[i]+"</div>";
                                }else{
                                html_content = html_content+"<div tabindex=\"0\" class=\"multivalue-subcell\" data-mv-index=\""+i+"\">"+tokens[i]+"</div>";
                                }
                            }
                        $td.html(html_content).addClass('string');
                    }

View solution in original post

0 Karma

sfatnass
Contributor

i solved it with that:

 if (cell.field === 's_conDx'){
            var valueDx = String(cell.value)
            var html_content= "";
            var tokens =[];
            var separators = [ '\\,' ];    
            tokens = valueDx.split(new RegExp(separators.join('|'), 'g'));
            for(var i =0; i<tokens.length;i++){
                var numbers = parseFloat(tokens[i].split(":")[1]);
                                        if(numbers <= criticalval){
                            html_content = html_content+"<div tabindex=\"0\" class=\"multivalue-subcell\" style=\"color:#E80C0C;\" data-mv-index=\""+i+"\">"+tokens[i]+"</div>";
                                }else{
                                html_content = html_content+"<div tabindex=\"0\" class=\"multivalue-subcell\" data-mv-index=\""+i+"\">"+tokens[i]+"</div>";
                                }
                            }
                        $td.html(html_content).addClass('string');
                    }
0 Karma
Get Updates on the Splunk Community!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...