0

I am using custom lookup code on a form string control. It works great, unless there is any text in the field. Then, it always returns blank unless what is entered in the field is an exact match for a value in the list. My preference would be for the text in the field to serve as a startsWith filter (and already addressed when I make the value list), but at this point, I would be happy with even the full list appearing, instead of blanks.

public static client void lookupList(FormStringControl _formStringControl, List _valueList)
{
    ListIterator valueIterator;
    myLookupTempTable tempLookupTable;
    SysTableLookup  sysTableLookup;

    if (_formStringControl && _valueList && _valueList.typeId() == Types::String)
    {

        valueIterator = new ListIterator (_valueList);

        while (valueIterator.more())
        {
            tempLookupTable.Value = valueIterator.value();
            tempLookupTable.insert();
            valueIterator.next();
        }

        sysTableLookup = SysTableLookup::newParameters(tableNum(myLookupTempTable), _formStringControl);
        sysTableLookup.addLookupfield(fieldNum(myLookupTempTable, Value), true);
        sysTableLookup.parmTmpBuffer(tempLookupTable);
        sysTableLookup.performFormLookup();

        //dispose of the temp table
        tempLookupTable = null;
    }
}
Jan B. Kjeldsen
  • 17,817
  • 5
  • 32
  • 50
Brad
  • 1,357
  • 5
  • 33
  • 65
  • Which is the field you are trying to add the lookup? Can you show your code for adding the lookup to that field? – Il Vic Feb 19 '18 at 16:44
  • This code above works correctly in AX12 with text entered. I'm having trouble w/D365 env so haven't been able to test there. – Alex Kwitny Feb 20 '18 at 19:09
  • @IlVic - You can use any code since it's a temp table. I used this on a FormStringControl's `lookup` method: `public void lookup() { List list = new List(Types::String); list.addEnd('A'); list.addEnd('B'); list.addEnd('C'); myLookupTempTable::lookupList(this, list); }` – Alex Kwitny Feb 20 '18 at 19:09
  • @AlexKwitny is right... I tried your code in Ax365 (Up. 10) and it works perfectly. Your issue seems to be not reproducible, maybe you should provide more details. – Il Vic Mar 01 '18 at 15:12

0 Answers0