You can either do this a couple of ways based on the use case
In JS
If you want to do this programatically, you will have to write custom Javascript. Let's assume you have a table defined in XML and the search is called "median_search".
<row>
<panel>
<table>
<search id="median_search">
<query> ... | your search | ... </query>
</search>
</table>
</panel>
</row>
The corresponding Javascript to get the median value would look something like this,
var median_search = mvc.Components.getInstance("median_search");
var searchResults = median_search.data('results', {
output_mode: 'json_rows',
count: 0
});
searchResults.on("data", function() {
if (searchResults.hasData()) {
var results = searchResults.data().rows;
var length = results.length;
var column1 = searchResults.data().fields.indexOf("Column1");
var medianColumn = searchResults.data().fields.indexOf("Median");
var searchTerm = "The Column1 VALUE YOU ARE LOOKING FOR";
for (var j = 0; j < length; j++) {
if (results[j][column1] === searchTerm) {
submittedTokenModel.set("median_token", parseFlow(results[j][medianColumn]));
break;
}
}
});
... View more