Model Lookup returns a negative value with no data in the model

We have a UI only model lookup to an aggregate model of quote line items to return the value of a specific product to the Quote model. However when there’s no product in the quote line items the formula returns a -1 value. The model lookup formula we’re using is: MODEL_LOOKUP(QuoteLineSum, sumSubtotal, product2SubFamilyc, “Management Discount”) where subfamily is the specific product we need to pull the value for. We’ve also tried a JS snippet to reevaluate the formula and it still shows -1.

var params = arguments[0],

$ = skuid.$;

alert(‘in js’);

var model = skuid.model.getModel(“Quote”);


We’re completely stumped as in the console the QuoteLineSum object has no data rows with a value of -1 but in the Quote object where the UI formula lives, the data rows are showing the -1 value.

Anyone have any insight?

Never mind… We figured out that the model was being queried multiple times and we needed to set a condition to abort instead of deactivate.

The interesting thing though is if you requery the model of a model lookup and the search value is no longer present, it doesn’t clear the formula value (as it should)

You could add an:

IF(IsBlank({{$}}),0,MODEL_LOOKUP(QuoteLineSum, sumSubtotal, product2SubFamilyc, “Management Discount”))

@Skuidward_Tentacles It’s now just showing a value of 0 even with the product added to the quote lines

Try changing the formula to just


to see what the result is. I might have the merge variable format incorrect. It should show the number of rows In the aggregate model.