Lookup for field in QueryRun

Hi, 

I'm new in AX Development and have a question about the lookup form that is 
shown in the dialog that is created when calling the prompt() method on a 
QueryRun object. 
I have a QueryRun object with some fieldranges defined in it. One of these 
fields is the customer account (relation to CustTable). In the lookup table 
from that is displayed I would like to show some different fields from the 
CustTable. I only want to have these fields shown in this particular way, so I can't put the fields in the AutoLookup fieldgroup of the table. Is there a way to achieve this?

Thanks in advance. 

Youp

Hi there,

If I am getting your problem correctly, you can do that by creating a new EDT and attaching a new form to that EDT using property FORMHELP.

On that form, show fields acc. to ur requirements, use properties like, FRAMS= none, WINDOWTYPE= popup.

In the run() of form, put code of “element.selectMode()”, say custtable.accountNum.

In ur QueryRun class, when u are adding DialogField in dialog, put this EDT in the typeID.

I hope, it will resolve ur issue.

Best of luck

bye

Hi,

I think I don’t completely undestand what you are suggesting.

So what I should do:

  • create a new EDT

  • Create a new form using CustTable as datasource and add the fields I want to the grid and settings as described

  • Link the new form to the EDT by setting the FORMHELP property of the EDT to my new form

But then I need to add this EDT somehow to my query object. For the fields I use the method query.dataSourceNo(1).addRange(fieldnum(, )). But how do I do this for the EDT. What function should I use for this purpose?

Youp

Hi Youp,

I am not getting you. You are creating a form or dialog form using class??

If you are creating a form, you can easily create a run time lookup, using SysTableLookUp.

If you are creating a dialog form using class, to get input from user, I think you are also using a dialogfield, say customer account no, where user can choose customer account no. So, in dialog(), of that class, when adding a dialogfield on the dialogform, u have to give typeId. Now, when giving typeId, dont give custAccount as the typeId, instead of that, give your own newly created edt as typeId.

So, on dialog form, when you drill down the field, it will open your newly created form , rather than system deault custtable autoLookup form.

I hope, it will help you…

Bye.

In this case I’m not using a dialog, but I use the Query / QueryRun to let the user make a selection on the data that will be shown on the form. So this is what I do:

  • I create a query and add the datasource to this query

  • I add some range fields to the query and one of the range fields will be the customer account no. Here I want to use my specific lookup.

  • I add the query to a queryrun object and on this object the prompt() method is called so the user can make his selections. When doing a lookup on the field customer account the specific lookup should appear.

  • The entered selections will be used by a form to display data based on the entered selection.

This is similar to what is done in General Ledger / Inquiries / Voucher Transactions.

Regards, Youp