Wednesday 8 August 2012

How to filter the data based on combo selection ?

DataDic-->Tables--->MedicineTable-->Fields

ItemId(string)
ItemExpired(enum)
ExpiryDate(date)

Medicine-->BaseEnums-->ItemExpired
ItemExpired :: Yes
                      No
                      All

MedicineInfoForm-->Methods-->classDeclaration

public class FormRun extends ObjectRun
{
    QueryBuildRange qbr;
}

 MedicineInfoForm -->DataSources--> MedicineTable -->Methods-->init()

public void init()
{
;
    super();
    qbr =    MedicineTable_ds.query().dataSourceTable(tablenum( MedicineTable )).addRange(fieldnum( MedicineTable ,ItemExpired));
    qbr.value(queryValue(ComboBox.selection()));
}

MedicineInfoForm-->Design--->Design-->Group : ItemExpired--->ComboBox:combobox-->Methods-->
modified()

public boolean modified()
{
    boolean ret;

    ret = super();

    if(combobox.selection()== ItemExpired::All)
    {
    qbr.value('');
    }
    else
    {
    qbr.value(queryValue(ComboBox.selection()));
    }

     MedicineTable_ds .executeQuery();

    return ret;
}

No comments:

Post a Comment