Define $.each for a model based on filter criteria

  • 1
  • Question
  • Updated 4 years ago
  • Answered
Use case:
Define an array of rows on a model given 2 conditions then update rows with value 'myValue'

For given conditions:
ApptID__c = XXXX
DateA > DateB


$.each(myModel.data, function (i, row){
myModel.updateRow(row,myField, myValue);
});


How do I limit the rows based on my conditions?
Photo of Griffin Brown

Griffin Brown

  • 2,766 Points 2k badge 2x thumb
  • confundido

Posted 4 years ago

  • 1
Photo of Moshe Karmel

Moshe Karmel, Champion

  • 8,646 Points 5k badge 2x thumb
$.each(myModel.data, function (i, row){	
if(row.ApptId__c === XXXX && row.DateA > row.DateB){
myModel.updateRow(row,myField, myValue);
}
});
Photo of Griffin Brown

Griffin Brown

  • 2,766 Points 2k badge 2x thumb
How much do they pay you Moshe?
Photo of Moshe Karmel

Moshe Karmel, Champion

  • 8,646 Points 5k badge 2x thumb
That's a good question... : )
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Thanks Moshe! We do very much appreciate our champions.  Hopefully undying gratitude is sufficient compensation.  
Photo of Moshe Karmel

Moshe Karmel, Champion

  • 8,646 Points 5k badge 2x thumb
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
We might just have to put that on a Tee Shirt!