Filter grid

I got a setup form, at form load ,I want to filter by the Status field, all the Active must be on top and Inactive at the bottom,when I create a new item if its inactive it must be at the bottom when I save the same with Active it must be above the inactive.

am looking for directions or an example.

.

Hi,

You can try the below code to sort you form in the init method of the form to filter when you run the form.

QueryBuildDataSource qbds;
str       status;
int i;
status = "Active";

qbds = someTable_ds.queryRun().query().dataSourceNo(1);
for (i=1; i<=qbds.sortFieldCount(); i++)
{
    info(fieldId2name(qbds.table(), qbds.sortField(status)));
}

Please try and let me know for any queries.

Regards,

John

Hi,

The status field has 2 options which is Active and InActive, I want to display both with the Active on top and InActive below

Did you try the above solution?

Yes i did, i have replace someTable_ds with my datasource name, i get object not initialized error

you have to initialize the querybuildrange class

public void init()
{
    QueryBuildDataSource qbds;
    QueryBuildRange       qr;
    str       status;

    int i;
    super();
    m_vSplitter = new SysFormSplitter_X(vSplitter, gridContainer, element);


    status = "Active";

    qbds = IMXGoal_ds.queryRun().query().dataSourceNo(1);
    qr = qbds.addDataSource(IMXGoal).addRange(fieldNum(IMXGoal,GoalStatus));
    for (i=1; i<=qbds.sortFieldCount(); i++)
    {
        info(fieldId2name(qbds.table(), qbds.sortField(GoalStatus::Active)));
    }


}

what am i doing wrong here?.still getting object not initialized.

Can you share the xpo file to me?

Hi John,

Is there any other option for that?