Custom lookup method on form field, multiple values

Hi,

I have a small problem. I have a custom EDT (string, 250 characters) as a bound form field. I have a custom lookup code in the field, like so:

public void lookup()
{

SysTableLookup sysTableLookup = SysTableLookup::newParameters(tablenum(Address), this);
Query query = new Query();
QueryBuildDataSource queryBuildDataSource;
QueryBuildRange queryBuildRange;
;
sysTableLookup.addLookupfield(fieldnum(Address, CustomAddressNumber));

sysTableLookup.addLookupfield(fieldnum(Address, Street));
sysTableLookup.addLookupfield(fieldnum(Address, ZipCode));
sysTableLookup.addLookupfield(fieldnum(Address, City));

queryBuildDataSource = query.addDataSource(tablenum(Address));
queryBuildRange = queryBuildDataSource.addRange(fieldnum(Address, CustomAddressNumber));

sysTableLookup.parmQuery(query);

sysTableLookup.performFormLookup();

}

Now this works fine of course, but the problem is that this overwrites the previous selection value. For instance, I’ve selected a 1000, the value is in the field, I click the lookup open again, select 1001 and the field value is changed to 1001. What I want is the lookup work in the same way that it works on Queries, leaving the previous value intact. In which case my example value after the second selection would be 10001001.

Can this be done in a reasonable way?

Anybody? I’m open to ideas here :slight_smile:

I tried to override the modify method on the form and intercept the value, but with no luck.

Hi mrsalonen,

On the bound field control properties window(on your form), you will find a property as “ReplaceOnLookUp”.Set this property to “No”.This will allow you to select multiple values in your lookup.

Regards

Sindhu

Ahahaha! That’s it! Thanks for that - in seven years doing AX development I’ve never needed that property :smiley:

I love AX, nothing else can drive me up the wall like this :slight_smile: