This topic contains 6 replies, has 0 voices, and was last updated by darrenhillconsulting 7 years, 7 months ago.
-
AuthorPosts
-
March 13, 2017 at 8:02 am #1072
darrenhillconsultingHello all,
Anyone ever try to process a search with a Map/Reduce script. More specifically, I have a complex search that GROUPs and has lots of Formula(Numeric) This is a cached copy. Click here to see the original post.
-
March 13, 2017 at 8:39 am #1073
david.smithHave you tried the label yet?
-
March 13, 2017 at 10:38 am #1074
chanarbonSame thoughts as david.smith , there is a label option for the Column object. Also, if you are trying to retrieve the value, more or less, you should have an object that replicates the Column and feed it to the getValue function of the result.
-
March 13, 2017 at 11:41 am #1075
david.smithI ran a few tests of my own and was able to confirm your findings. I think this should be submitted as a bug in the MR process. The only way to get around this right now would be to run your search in the getInfo phase, create your own JSON object and send your results to the Map stage as a custom array of objects.
-
March 13, 2017 at 11:58 am #1076
MChammaTXI’m actually in the process of writing a map/reduce using a few formulas and label works for me. I first get the column index by label and then pass the column object to result.getValue(col[idx]).
Code:
var searchData = search.load({ id: 4374 });
var colsIdx = getColsIdx(searchData.columns);
var resultSet = searchData.run();
resultSet.each(function (result)
{
var data = result.getValue(resultSet.columns[colsIdx[“ARD”]]),
}……..
function getColsIdx(cols)
{
var retData = {};
for (var i = 0; i < cols.length; i++)
{
if (cols[i].label && (cols[i].name=="formulatext"||cols[i].name=="formuladate")){
retData[cols[i].label] = i;
}}
return retData;
} -
March 13, 2017 at 2:17 pm #1077
erictgrubaughThis problem with multiple formula columns has always bothered me. I feel like there should be a much easier way to reference these columns without having to do such manual translations or keep a reference to each column object hanging around. Even if I could just set a `customId` property or something that would get carried over into the search results. I don’t really care how it works, but there has to be a better way this can be designed on the API side.
-
March 28, 2017 at 6:44 pm #1078
darrenhillconsultingHey guys,
Ya, this is a real show stopper for Map/Reduce solutions.
-
AuthorPosts
You must be logged in to reply to this topic.