I am looping the returned results like this. It gi...
# suitescript
n
I am looping the returned results like this. It gives me the name and the column value , i need to get the column header. is there any function like. result.getHeader() ?
var searchData = [];
savedSearch.run().each(function(result) {
var rowData = {};
savedSearch.columns.forEach(function(column) {
rowData[column.name] = result.getValue(column);
rowData[column.name + '_text'] = result.getText(column);
});
log.debug('Search Result', rowData);
searchData.push(result);
return true;
});
a
I'm not even sure what you're asking?
but you said you're getting the name? do you mean you're able to getText, cos the only name reference here is the column name... and the column name ... IS the header?
maybe screen cap your log so we can see what it is doing?
n
Copy code
{
  "recordType": "revenuearrangement",
  "id": "3315291",
  "values": {
    "formulatext": "3315291-3-2",
    "postingperiod": {
      "value": "374",
      "text": "Dec 2019"
    },
    "type": {
      "value": "RevArrng",
      "text": "Revenue Arrangement"
    },
    "tranid": "3",
    "formulacurrency": ".00",
    "revenueelement.allocationDetail": "2"
  }
}
Thsi is the data i am getting from my search. The issue is the column heading is returned as "formulacurrency" while the Column label is given as. "S1Value"
I want to use the column Lable, instead of column name
when i have 2 formulacurrency column (Headings are 'S1Value' and. 'S2Value') . as it is considering the name as 'formulacurrency' as key , it merges/replaces and shows only one 'formulacurrency' column
i need to reference those as. 'S1Value' and 'S2Value'
This screenshot is the returned value of the following finction: var savedSearch = search.load({ id: 'customsearch_60' });
a
okay... so use column.label?
n
I got it working. Thanks for the help guys. I appreciate that.
👍 1