Skip to main content

Can someone give me a quick thumbs up/down on my syntax?


var $ = skuid.$;<br>var mSTD = skuid.$M('STDTest');<br><br>$.each(mSTD, function(i, row){ <br> value += row.STD__c + ' (' + row.Results__c + ') '; });


If my model STDTest has two rows:
Row 0 has STD__c: HSV1, Results: Negative
Row 1 has STD__c: HIV, Results: Positive

I’m trying to produce a text variable ‘value’ that would look like:
'HSV1 (Negative) HIV (Positive) '

Am I understanding the way $.each works?

Your mSTD variable is a reference to the model object.  So your code as is would iterate over the properties of the model.  This is most likely not your intention.  You should iterate over mSTD.data instead.


$.each(mSTD.data, function(i, row){<br>&nbsp; &nbsp; value += row.STD__c + ' (' + row.Results__c + ') ';<br>});

Thanks, Ben!