Using dynamic filter on screen load

Hi,

I am trying to extend a browser screen to apply a filter based on optional screen parameters (WindowParam). I want the parameters to be applied to the table that is shown and (preferably) the user should be able to switch back to the unfiltered view easily.

The screen should allow for three or more optional parameters to filter on (e.g. user or one or two different values). By default the screen would load without any filter set.

What is the best way to move forward? I already have the window parameters in place and I’ve tried to apply these parameters via the filter component:


filter.setParamValue("Parameter",value);

or using the datamanager:


objectsDs.setQueryFilter( what to put here???);

Both attempts did not provide the result I hoped for. Any ideas?

1 Like

Hi,

take a look at this stackoverflow question: Open window with filter in Cuba Platform controller - Stack Overflow

I ended up with creating a filter query myself based on the window parameters and apply that to the datasource:


            // Construct filter based on string parameter
            String filterQuery = "";
             if (parameter != null) {
                   filterQuery += " and e.field = " + parameter;
            }
            // Apply filter
            objectsDs.setQuery("select e from app$Object e where e.status = 'Open' " + filterQuery);
            objectsDs.refresh();
1 Like