Most efficient way to check if field is in another model What’s the most efficient way to check if a field is in another model in Javascript? I have this situation come up many times, usually during a field render in a list view. Here’s one situation:Product list viewEditable list of Products
Want to show a “Total quantity owned” field (can be Ui only) that is really an aggregate of a stock object
What I’m currently doing:Create aggregate model on Stock grouping by Product, summing Quantity
Create JS field render that does a for loop on my aggStock model
Compare the field being rendered to each field in aggStock, if the Id’s match up, pull the aggQuantity field and append it using a field render. If no matches are found, put a 0 for quantity.
Apply custom field render on my quantity field
This does work. But it seems terribly inefficient that for each field in my list, I am cycling through every field in another model and comparing the Ids. Would it be better to:Have a condition on my aggStock model where Product Id = null and set that condi