How to get more than one field value with lookup method in Ax 2009

Hi,

i want to get more than one field value with lookup method in ax 2009 with code… Example;

i have a table. Table1. table1 include 5 fields. field1,field2,field3,field4,field5.

i can get only field1 with classic lookup method… but i need field1 value and field2 value…

thanks.

Hi,

I assume you’re using SysTableLookup class to perform specific lookup, you just have to add the following code to add fields in your lookup:

sysTableLookup.addLookupfield(fieldNum(yourTable,YourField1));

sysTableLookup.addLookupfield(fieldNum(yourTable,YourField2)); etc…

Hope it helps, please verify solution if it solves your problem

regards,

Thomas

How you are building the lookup?

Thanks Thomas… but i think i couldnt my problems…

my code this.

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

;

sysTableLookup.addLookupfield(fieldNum(Table1, field1));

sysTableLookup.addLookupfield(fieldNum(Table1, field2));

sysTableLookup.addLookupfield(fieldNum(Table1, field3));

sysTableLookup.addLookupfield(fieldNum(Table1, field4));

sysTableLookup.addLookupfield(fieldNum(Table1, field5));

i can get value of field1 when select lookup. But i want to get value of field1 and field2…

How to make this…?

try the following: after your first line with sysTableLookup, my example uses CommissionSalesGroup Table

Query query = New Query();

QueryBuildDataSource QueryBuildDataSource;

QueryBuildRange QueryBuildRange;

;

QueryBuildDataSource = query.addDataSource(tableNum(CommissionSalesGroup));

QueryBuildRange = QueryBuildDataSource.addRange(fieldNum(CommissionSalesGroup,name));

sysTableLookup.addLookupfield(fieldNum(CommissionSalesGroup,name));

sysTableLookup.parmQuery(query);

sysTableLookup.performFormLookup();

Your explanation of the problem is not clear. Can you please elaborate what is your problem or what is your requirement?

When you post the code, try to post the total code.

Hello again,
EDT to customize the combobox was created with. Customization code below. In many places, if I want to display which fields of the table in this way use flags that pertain to. In this way after making the selection, customization and only can the value of a field in a table (Table1. of field1).But after the election problem here 2 field value order (table1. of field1 and field2 table1.).

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

;

sysTableLookup.addLookupfield(fieldNum(Table1, field1));

sysTableLookup.addLookupfield(fieldNum(Table1, field2));

sysTableLookup.addLookupfield(fieldNum(Table1, field3));

sysTableLookup.addLookupfield(fieldNum(Table1, field4));

sysTableLookup.addLookupfield(fieldNum(Table1, field5));

sysTableLookup.parmQuery(query);

sysTableLookup.performFormLookup();

EDT lookup usually uses field contained in autoreport fieldgroup (see your table properties), if you add fields in autoreport field group they should appear in your lookup without adding lookup method on your field. My code can be used as custom lookup for field that does not have EDT

Yes Thomas this code not EDT. but i can use selected row field1.

But i want to use filed1 value and field2 value when selected row with combobox… by the way my english is not good… sorry…

Hello again,
first as seen in the image options “Madde Kodu” field is equipped with two U054 0002 00. One of the other “Konfigürasyon” 00 other 01. After making the selection, as shown in the second image only “Madde Kodu” field information. Sets the “Konfigürasyon” area of the 00 or 01 is not known. For this reason, the choice and I want to know the value of two fields at the time. How can we do this process.

picture 1
0317.01.jpg

picture 2

0842.02.jpg

It will show only the selected field value. Konfigürasyon is a different field.

Would it be possible for you to add Konfigürasyon field in the grid and populate it after the selecting/modifying the Madde Kodu value?

Thanks Kranthi.

If I understand it correctly, you’re saying the selection was done twice. first select “Madde Kodu” ,then “Konfigürasyon” area should be selected?

The selection of Konfigürasyon need not be manual.From the Madde Kodu value , you need to find the related Konfigürasyon value and update that field.

I am saying to add two fields to the grid, upon selection of one you can updated the other field value.

:frowning: Sorry icant understand… :frowning:

Thanks …

which part you didn’t understand?

How to find the Konfigürasyon value after selection??

there should be some relation between them right? (you can write a select statement to find the value)

but there is two row for “madde kodu” field… ??

Select * from table1 where table1.MaddeKodu == this.text();

result 2 rows??

It is not known which one is selected again.

i solved with recid… Later Select statement…

Thanks everybody…