This topic contains 6 replies, has 0 voices, and was last updated by darrenhillconsulting 7 years, 7 months ago.

  • Author
    Posts
  • #1072

    darrenhillconsulting

    Hello 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.

  • #1073

    david.smith

    Have you tried the label yet?

  • #1074

    chanarbon

    Same 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.

  • #1075

    david.smith

    I 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.

  • #1076

    MChammaTX

    I’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;
    }

  • #1077

    erictgrubaugh

    This 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.

  • #1078

    darrenhillconsulting

    Hey guys,

    Ya, this is a real show stopper for Map/Reduce solutions.

You must be logged in to reply to this topic.