Combine several filter object queries into one project

For example you want to filter objects which exists on several layers.
We need to temporary modify SysProjectFilterRunBase class:
Add new variable to class declaration:
    Set                     objectList;
Modify main method. Modify statement of following if conditions:
if (sysProjectFilterRunBase.prompt())
To the following look:
            sysProjectFilterRunBase.run(1);
            if (sysProjectFilterRunBase.prompt())
            {
                sysProjectFilterRunBase.run(2);
            }
            sysProjectFilterRunBase.write();
Modify run method:
Change signature of run method:
public void run(int _runNum = 1)
Add following set initialization before while statement:
    if (!objectList)
    {
        objectList = new Set(Types::String);
    }
Add following code after standard line ( set.add(path); ):
            if (1 != _runNum && !objectList.in(path))
            {
                continue; // skip as we want to collect objects that meet all queries
            }
            else if (1 == _runNum)
            {
                objectList.add(path);
                continue; // at first step we do not want to add any elements
            }
Usage:
1. Run standard Advanced Filter/Sort
2. Set ranges for first query and press OK button.
3. Project filter prompt dialog will apperar again.
4. Set another ranges for second query and press OK button.
5. As a result you will have objects in project which meets both queries.

You can easily modify this solution to have as much query runs as you want.

Overview of changes:



 

Search

About

DaxOnline.org is free platform that allows you to quickly store and reuse snippets, notes, articles related to Dynamics AX.

Authors are allowed to set their own AdSense units.
Join us.

Blog Tags