How to get the Filterable subcondition using javascript

  • 1
  • Question
  • Updated 4 years ago
  • Answered
Hello I have a condition on a model. The state of the condition is filterable default off with name 'Process_Id' and value is result of subquery. And I also have subcondition on that sub query and the state of the subcondition is also filterable default off with name 'ServiceType'. How can I access Subcondition 'ServiceType' using Javascript.  Thanks!
Photo of Gyan

Gyan

  • 1,400 Points 1k badge 2x thumb

Posted 4 years ago

  • 1
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k badge 2x thumb
getConditionByName takes a 2nd boolean parameter --- if this parameter is set to true, then filterable Sub-Conditions will be searched / returned as well by getConditionByName, e.g.

// Get a reference to our model
var myModel = skuid.model.getModel('MyModel');
// The 2nd parameter being set to true 
// tells Skuid to look through Sub-Conditions as well as top-level Conditions for name matches
var serviceTypeCondition = myModel.getConditionByName('ServiceType',true);
// Change the value of the Condition
myModel.setCondition(serviceTypeCondition,'some service type');

For more details, go to the skuid.model.Model object API documentation, and search for getConditionByName