Filter Entity based on Multiple values in Xpath

0
Hi Team, We have a campaign page to create the survey for mass user. On the page user can select multiple filter criteria like Job Descriptions, Regions,  Business Channels, Countries etc. User will be able to select multiple values for each filter criteria. A user account also has a region, a Job description, a business channel and a country associated with it. Now when user generates surveys,  all accounts matching to selected filters criteria (each criteria can have multiple values) should show on the screen. I have done this using micro flow however performance is not good. We need to implement this logic in Xpath. Please advise how can we do this in Xpath. Association between Campaign and fields Campaign *----------* Job Description Campaign *----------* Region Campaign *----------* Business Channel Campaign *----------* Country   Association between Account and fields   Account*----------1 Job Description Account*----------1 Region Account *----------1 Business Channel Account *----------1 Country   THanks, Pankaj
asked
4 answers
1

Hi Pankaj, 

I read, you did all the filtering in microflow but it is having performance issues. And you want to do using XPATH. So, what you want to do in XPATH is still not clear to me. 

Even if you want to retrieve in XPATH:

- you could possible do this with retrieve activity in microflow’s: https://docs.mendix.com/refguide/xpath-source

- Or you could choose to write a java action: https://docs.mendix.com/refguide/xpath. Also refer https://apidocs.mendix.com/7/runtime/com/mendix/core/Core.html#createXPathQuery-java.lang.String-

answered
0

Did you try using a datagrid with xpath datasource and standard search filters?

If so, what was missing there?

You could also consider listview controls: https://appstore.home.mendix.com/link/app/105694/

Or grid search: https://appstore.home.mendix.com/link/app/49364/

I hope this helps.

answered
0

What about a datagrid of accounts with xpath or database datasource, with standard serach filters for all attributes you are refering to. You can enable multiselect in those filters.

As soon as you click search, you will preview what accounts were selected. It will produce the selection in milliseconds without complex microflow filtering logic. You can fine tune the selection. Once satisfied with you selection, you let the user click a “call microflow” button called someting like “create surveys” which creates surveys for all accounts selected in the grid.

Would that work or am i still missing the point?

answered
0

I get a better picture now. Thanks.

I see several options, there could be more options:

  1. optimize the queries in the microflow. By studying the distribution of data in your database, you can make sure you filter out the most limited set of data in the first query that you do, so you retrieve the data in the most efficient way. But anyway you will be stuck with doing several retrieves/filters in one after the other. Maybe setting an index will help.
  2. Do the filtering in a java action. In java, zou can build up the entire xpath and execute it on the database in one query. https://www.mendix.com/blog/easy-xpath-retrieval-in-java/
  3. Do the filtering in javascript. I am not sure if you will be able to achieve the same results as in java, but it could be worth investigating.
  4. Settle for the lower performance. You could consider running the queries asynchronously or in a night time batch, so the user does not have to wait for it.

 

In you case, i would first try option 1, in many cases a lot of performance can be gained by just careful reconsideration.

And if that does not work, option 2. But that requires java knowledge.

I hope this helps.

answered