Time taking to retrieve data using mocroflow-Java Action compared to Datagrid2 xpath

0
I am using Datagrid2 to display data and used data source as xpath. It works good and when i open the tab the data is showing instantly. But i need to make one column filter dropdown with many-to-many association attribute. i see where we use custom content and the listview in datagrid2 to show data. But i can't use filter there.  so i used NPE entity linked with the attribute. i added a reference selector to select the options and then used datagrid2 source as microflow. In the microflow i used java action to retrieve data based on selected values. But it is taking 7-10 sec in our TST envinorment to show the data when clicked on the tab. i have given the sample domain model and implementation below. Could someone please help me on how to reduce the time taken to retrieve data? Thanks in advance.
asked
1 answers
0

Hey,

It would be nice if you can let us know java action as well, but I am assuming you might be using xpath (refer below image as an example)  inside java action so basically, you have 2 options -

 

1. (Handle this inside MF)Create a new list of Student_result list, iterate over college options, retrieve all the students associated to iterator object using xpath-db and then add that student list to result list and then return list list. This will be slower but not that much.

2. For larger records, option 1 might run slow depending on how many filters have been provided, but if you want more faster retrivial, then you need to modify underline part of option 1. So instead of using xpath-db you can directly Execute OQL query (you need to write OQL for it and need to download OQL module), but remember the OQL query will always return newly created objects in its result so again you need to iterate over result objects and then retrieve actual students list and then return that

 

But after seeing your domain model setup, I am pretty much sure option 1 will work much better.

 

Cheers,

Naman Khard

 

 var xpq=com.mendix.core.Core.createXPathQuery(
                "\
                //System.FileDocument[\
                   contains(Name,'$nam')\
                   and\
                   contains(Name,'$ext')\
                   and\
                   Size>$siz\
                ]\
                "
            );
            xpq.setVariable("nam","a")
            xpq.setVariable("ext","xls")
            xpq.setVariable("siz",100)
            xpq.setAmount(8)
            xpq.setOffset(0)
            xpq.setDepth(1)
            xpq.setDisableSecurity(true)
            xpq.addSort("Size",true);
            var arr_obj=xpq.execute(context);
            ...
        var xpathFormat="//System.FileDocument[\
                contains(Name,'%s')\
                and\
                contains(Name,'%s')\
                and\
                Size>%s\
            ]";
        var amount=1;
        var offset=0;
        var sort={};
        var depth=1;
        var arr_obj=com.mendix.core.Core.retrieveXPathQueryEscaped(
            context,
            xpathFormat,
            amount,
            offset,
            sort,
            depth,
            "xlsx",
            "a",
            "100"
        );

 

answered