Filter Data Grid by Attribute of context object

Hi there! Is there any way to filter data of a data grid by attribute values of the page’s context object? The data grid is placed inside a data view that has its data source type set to “context”. I have tried to use an xpath constraint like [attribute_name=[%CurrentObject%].attribute_name] but it doesn’t work.  Database constraints do not seem to work either, as associations are not displayed in the attribute dropdown. Is there any way to fix the xpath constraint or any other way to get the filter working?   Kind regards and thanks in advance, Niklas
1 answers

Hi Niklas,

The current object token is mainly used for associations and not the attribute values of the object. But you can use the any search widget from the grid search widgets to apply an xpath constraint to your datagrid. You could use a non persistent entity with a string attribute, add a dataview to your page sourced by a microflow, in your data source microflow pass the page context object and create an xpath constraint, set the value of non persistent entity string attribute to the value of the xpath constraint, and then have the any search widget apply the xpath constraint to your datagrid. 


Your xpath could look something like this:

[Name = 'John Doe']

Where John Doe is the value of the name attribute of your context object.


Here is a link to the grid search widget. I would check out the example project on github.


Hope this helps!