How to modify MainAccount Lookup in Segmented Entry Control

Hi

One of my friend asked me  “How can i modify MainAccount lookup in Segmented entry control?”. I did not know how to do that. After some research i found LedgerDimensionAccountController class which controls Segmented Entry Control.  After some working i found a method named restrictQueryForMainAccounts() .


public static void restrictQueryForMainAccounts(QueryBuildDataSource
                                             _queryBuildDataSource)
{
    QueryBuildRange qbr;
    //--> FD
    QueryBuildRange qbrFD;
    // <-- FD

    str evalCriteria = strFmt('(%1.Type != %2)',
        _queryBuildDataSource.name(),
        queryValue(enum2int(DimensionLedgerAccountType::Reporting)));
    ;

    qbr = _queryBuildDataSource.addRange(fieldNum(DimAttributeMainAccount, Type));
    qbr.value(evalCriteria);
    qbr.status(RangeStatus::Hidden);

    //--> FD
    qbrFD = _queryBuildDataSource.addRange(fieldNum(DimAttributeMainAccount, value));
    qbrFD.value("3*");
    // <-- FD
}

If you open segmented entry control and lookup mainAccount before modification of this method you can see all MainAccounts .

If you modify the method you can see only data starts with “3″ as you can see blow image.

It may not be the correct way to do this but it works. I dont recommend to do such a modification at framework classes. If you have to, be very careful.

Until next time.

 
Comment are closed.