Monday, August 28, 2017

Adding Query range in Multiple lookup in ax 2012

//Adding Query range in Multiple lookup in ax 2012
public void addRangeMultipleValue(tableId _table, fieldId _field, Query _query,str _delimitedMultipleValues)
{
    List                list;
    ListEnumerator      items;
    str                 currentItem;
    list = new List(Types::String);
    if (_delimitedMultipleValues != strMin())
    {
        list = strSplit(_delimitedMultipleValues, #ExpressionDelimiter);
        items = list.getEnumerator();
        while (items.moveNext())
        {
            currentItem    = items.current();
            if (currentItem != strMin())
            {
                this.addSearchCriteriaString(_table, _field, _query,currentItem, true);
            }
        }
    }
}
public void addSearchCriteriaString(tableId _tableId, fieldId _fieldId, str _attributeValue,Query _query,boolean _like = true)
{
    QueryBuildDataSource    qbds;
    QueryBuildRange         qbr;
    qbds = query.dataSourceTable(_tableId);
    if (qbds != null)
    {
        qbr  = qbds.addRange(_fieldId);
        if (_like)
        {
            qbr.value(SysQuery::valueLike(_attributeValue));
        }
        else
        {
            qbr.value(SysQuery::value(_attributeValue));
        }
    }
}

No comments:

Post a Comment

Copy Markup charges while posting purchase invoice using X++

 Copy Markup charges while posting purchase invoice using X++ Class: Important: Code logic is just for Reference.  New class => Duplicate...