Thanks Will,
So we've been using MR for while now(ages) with 100's of jobs and Asya has been suggesting that we should start using aggrF to solve other problems especially after the $out parameter since that was one of the major reasons why we went MR and secondly the flexibility of using Javascript. Anyway, long story short, we started converting some of these reports and it seems aggrF is just not there yet, we do so many calculations with JS but using basic functions. Regarding this question we allow our customers to search text using simple functions for example, they could say give me all rows where last name contains "Jack" or first name starts with "John" or email ends with ".io" - so this works in match - perfect.
Now, second scenario (Crucial) is were the customer can say for example if referring url contains "
doubleclick.com" then column is "Paid Search" otherwise "Organic"
we knocked this out with MR easily using JS functions, however, in aggr when I project out with a cond it errors out, what I need is a projected field that is like field = (fieldX contains doubleclick ? "Paid Search" : "Organic");
we were able to implement all the basics (equals, notequals, gt, le, gte,lte, etc..) but not (startswith, endswith,contains, doesnotcontain) in aggrf.
in MR we have js functions like...that we use in the map phase or use RegEx /
doubleclick.com/i - which works perfectly. hope that explains it. I need to set the values of certains fields in a project based on a true/false condition.
Contains: function (data, str) {
/* Determines if data contains string */
if (data == null || str == null) return false;
return data.length >= str.length && data.toLowerCase().indexOf(str.toLowerCase()) >= 0;
}
Andre