Can you use the selected value from a table filter to populate a field?

Is it possible to retrieve the selected value of a table filter to use to populate a row field? I want to have an action that creates a new row and populates one of the row fields with the value selected in the table filter.

See this screenshot—I am looking for something to put in the “Value” field that references the filter. Is that possible?


Certainly with javascript. You would create a model action to use a snippet. From there you’d specify the field to update and use the value in the condition.

If the model that you are creating the row in is the same as the Model that you are filtering, the new row will already get the value of all active Conditions — i.e. in your screenshot, the new row you are creating in the GroupServices_GrpSvcsListPage model would already have a RecordTypeId populated if the RecordTypeId filter was on a table connected to the GroupServices_GrpSvcsListPage model.

if the Models are different, though, you could use Merge Syntax to get the value of the Filter’s associated Model Condition using the Condition’s index relative to other Conditions in the Model: {{$Model.ModelWithFilter.conditions.0.value}} — where the conditions are zero-indexed, so if you have 2 Conditions, this would get the first condition’s value, or if you have 10 conditions and the RecordTypeId condition is the 10th, you’d want to do {{$Model.ModelWithFilter.conditions.9.value}} — hence this is a bit fragile because if you add / remove condiitions you’ll have to adjust this, in which case Pat’s suggestion of using a snippet would probably be more safe, your snippet could use Model.getConditionByName() to access a condition using the name, which is more stable than the index, e.g.

var model = skuid.model.getModel(“ModelWithFilterOnIt”);
var recordTypeCondition = model.getConditionByName(“RecordTypeId”);

var grpServicesModel = skuid.model.getModel(“GroupServices_GrpSvcsListPage”);
var row = grpServicesModel.createRow();
grpServicesModel.updateRow(row, “RecordTypeId”, recordTypeCondition.value);