cancel
Showing results for 
Search instead for 
Did you mean: 

Filter MDK Application

0025026947
Explorer
0 Kudos

Hello Experts,

As part of our new project we have to develop an SAP MDK application.

On the main page, we have a button to navigate to the filter page that contains some ListPicker controls from which we get the values of filter criteria.

When we select values from those lists and click on filter button, we will navigate to the next page which contains an Object Table that we add a rule in QueryOptions in this table object that retrieves the selected values from the previous page.

This method works well, but it uses a static code to build the request to the backend.

Could you please provide me a solution to use the filter action or some dynamic approach to use it instead of the static method?

Thank you in advance.

Best regards.

Maroua ABBOUR

View Entire Topic
bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

The filter action is typically included from a button in the action bar or toolbar to open a filter page from the list (Object Table) page. On the filter page the user can select criteria and when done it will apply that filter to the list page. You can see an example of it in the MDK Demo Application on the sample repo. If you tap the All Products link under the Promotion Items in the upper right is a Filter button that calls the filter action to let the user select criteria and apply it.

0025026947
Explorer
0 Kudos

Thank you for your answer, in my case I have access to the list page after selecting the filter criteria.

In my case I need to apply the filter before showing the list page.

Is there another method to apply the filter dynamically?

Thank you in advance.

Maroua ABBOUR

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

From your original description you are already dynamically applying the filter using the Query Option rule. I guess I am not understanding what you are wanting to achieve here. Can you please elaborate?

0025026947
Explorer
0 Kudos

Thank you for your response bill.froelich, in our scenario, we have a "Form cell page" which contains five "List Picker" controls and a "filter" button.

After pressing under this button, we will navigate to the list page that contains an 'object table'.

In the "QueryOptions" of this table, I created a rule in which I built a static request to the back-end based on the selected values from the previous page.

I have attached a part of my code to clarify the idea.

Is there another method to apply the $filter request to the back-end in the online service dynamically?

Thank you again.

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

Effectively the list page is dynamic in that when it opens your rule constructs the filter based on the 5 list pickers. Are you looking for the user to be able to adjust the filters once the list is displayed but wanting to default them based on the initial selection?

0025026947
Explorer
0 Kudos

Yes and without writing any static code if that possible.

Thank you again.

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

I would recommend looking at the example of it in the MDK Demo Application on the sample repo. If you tap the All Products link under the Promotion Items in the upper right is a Filter button that calls the filter action to let the user select criteria and apply it. This is an example of how a user can adjust the filters for a list on the fly.

It all depends on what you want the flow to be. One option would be to just open the list page without any initial filters and display all the data, You can still apply query options to define the initial list. Then the user can open the filter page to see the list pickers to choose filter criteria and apply to to the existing list page.

If you want your flow to prompt the user to initially define the filters before opening the page as you described, then you will need a rule to create those as filter criteria instead of as query options and bind the rule to the Sectioned Table > Filters on the list page.

0025026947
Explorer
0 Kudos

I would first thank you for your help and the quick reply bill.froelich.

I have tried to implement the solution that you suggest to me (By making the filter as a rule in Sectioned Table > Filters instead of in query options), but i still have an issue, the backend method is called twice ( the first time without any filter and the second with the selected values ).

Is there a way to implement to skip the first call?

Thank you again.

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

I will have to open an internal issue for this to be investigated further.

0025026947
Explorer
0 Kudos

Is there any news regarding this point?

Thank you again.

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

We are testing an optimization to apply the filter earlier in the loading process to avoid the second call. It should be released in upcoming patch.