Creating a search without a database

Lots of links to create queries there, but everyone seems to be extracting their values ​​from the query.

I want to add a search to a field that will add items from a list of values ​​that do not come from a table, query, or any other data source.

For example, from the line: "Bananas, apples, oranges" .. or a container ["Bananas", "Apples", "Oranges"]

Assume the string / container is a dynamic object. Drawing from a static enumeration is not an option.

Is there a way to create searches on the fly from something other than a data source?

Sample code would be a big help, but I will also use hints.

+3
source share
5

, , - AX 2012:

Copy the sysLookup form from AX2009 (rename it) and import it into AX 2012.     
We'll call mine myLookupFormCopy.
I did a find/replace of "sysLookup" in the XPO file to rename it.

:

public static client void lookupList(FormStringControl _formStringControl, List _valueList, str _columnLabel = '')
{
Args    args;
FormRun formRun;
;

if (_formStringControl && _valueList && _valueList.typeId() == Types::String)
{
    args = new Args(formstr(myLookupFormCopy));
    args.parmObject(_valueList);
    args.parm(_columnLabel);
    formRun = classFactory.formRunClass(args);
    _formStringControl.performFormLookup(formRun);
}
}

:

public void lookup()
{
List    valueList = new List(Types::String);
;

...build your valueList here...

MyClass::lookupList(this, valueList, "List Title");

super();
}
0

.

Global pickXxxx, pickList. , pickUser, pickUserGroup ..

. , , . !

Update:

.

. : , .

+2
public void lookup()
{
    SysTableLookup                  sysTableLookup;
    TmpTableFieldLookup             tmpTableFieldLookup; 
    Enumerator                      en;    
    List                            entitylist      = new list(types::String);

    entitylist.addend("Banana");
    entitylist.addend("Apple");

    en = entityList.getEnumerator();

    while (en.moveNext())
    {
        tmpTableFieldLookup.TableName = en.current();               
        tmpTableFieldLookup.insert();
    }

    sysTableLookup = SysTableLookup::newParameters(tableNum(tmpTableFieldLookup), this);

    sysTableLookup.addLookupfield(fieldNum(TmpTableFieldLookup, TableName));

    //BP Deviation documented
    sysTableLookup.parmTmpBuffer(tmpTableFieldLookup);
    sysTableLookup.performFormLookup();
}

.

+1

I also assume that there is no way to do a search without a table. I say this because search is just a form with one or more data sources that display differently.

I also wrote about this on my blog, so you can get information on how to perform a search, even with a temporary table, here:

http://devexpp.blogspot.com.br/2012/02/dynamics-ax-custom-lookup.html

0
source

Example from global :: PickEnumValue:

static int pickEnumValue(EnumId _enumId, boolean _omitZero = false)
{
    Object      formRun;
    container   names;
    container   values;
    int         i,value = -1,valueIndex;
    str         name;
    #ResAppl
    DictEnum dictEnum = new DictEnum(_enumId);
    ;
    if (!dictEnum)
        return -1;


    for (i=1;i<=dictEnum.values();i++)
    {
        value = dictEnum.index2Value(i);
        if (!(_omitZero && (value == 0)))
        {
            names += dictEnum.index2Label(i);
            values += value;
        }
    }
    formRun = classfactory.createPicklist();
    formRun.init();
    formRun.choices(names, #ImageClass);
    formRun.caption(dictEnum.label());
    formRun.run();
    formRun.wait();
    name = formRun.choice();
    value = formRun.choiceInt();
    if (value>=0) // the picklist form returns -1 if a choice has not been made
    {
        valueIndex = -1;
        for (i=1;i<=conLen(names);i++)
        {
            if (name == conPeek(names,i))
            {
                valueIndex = i;
                break;
            }
        }
        if (valueIndex>=0)
            return conPeek(values,valueIndex);
    }


    return value;
}
0
source

All Articles