SBX - Search With Button

SBX - Forum Post Title

Cannot find SysMultiTableLookup class in AX 2012 R2

Microsoft Dynamics AX Forum

Kauto asked a question on 29 Oct 2015 11:40 AM
My Badges

Question Status

Verified

Hi,

I've read a few posts about SysMultiTableLookup class but I don't appear to have it in AX 2012 R2.

Is this only available in a certain build?

Could someone send me an xpo with the class or post the code for it so I can copy it as I require it for a complex lookup override.

Thanks

Reply
Boye Walters responded on 29 Oct 2015 3:51 PM
My Badges

I cannot find it in fully patched R1,R2 or R3.

Reply
Stefan Hofmaninger responded on 30 Oct 2015 5:52 AM
My Badges
Verified Answer

Hi,

I think this class is not standard in AX 2012 -> I have also downloaded this class as an xpo an made a few corretions in the code.
Here's a link where you can download the class:

http://axbooster.blogspot.co.at/2014/05/lookup-from-multiple-table-ax-2009.html

Regards

Stefan

Reply
Kauto responded on 30 Oct 2015 8:31 AM
My Badges

Thanks for clarifying this for me Stephan, I thought I was going mad when I couldn't find it in the AOT, despite some forum posts mentioning it.

In addition to this, I am trying to override the customer lookup on the SalesCreateOrder form, I had presumed this is controlled by the form CustTableLookup but this doesn't seem to be the case, could you direct me on how this lookup is controlled?

I would simply override the code on the form, but when I add in the tableMethodStr name to return the customer name, I get a blank value.

Using:

SysTableLookup.lookupMethod(tableMethodStr(CustTable,Name));

Hoping to return the customer name by using the name display method against the CustTable

Reply
Kauto responded on 3 Nov 2015 4:17 AM
My Badges
Verified Answer

I came across this article on a post elsewhere - I have employed this mechanism to achieve what I need - it is actually very easy to do and makes sense.

It is actually very easy to combine multiple datasources in a sysTableLookup. Here is the trick I used to be able to filter on the name from the EcoResProductTranslation in the lookup for items.

1) Create a view that combines all your datasources and add the fields you would like to see in your lookup to the view.

2) Create a query from the view created in step 1.

3) Use these to perform your lookup as follows...

static client void lookupItemActive(FormStringControl _ctrl)

{

   SysTableLookup sysTableLookup = SysTableLookup::newParameters(tablenum(<ViewName>),_ctrl);

   Query          query = new Query(queryStr(<QueryName>));

   sysTableLookup.addLookupfield(fieldnum(<ViewName>, ItemId));

   sysTableLookup.addLookupfield(fieldNum(<ViewName>, Name));

   sysTableLookup.addLookupfield(fieldNum(<ViewName>, ItemGroupId));

   sysTableLookup.addLookupfield(fieldnum(<ViewName>, Status));

   sysTableLookup.addLookupfield(fieldnum(<ViewName>, RevId));

   sysTableLookup.addLookupfield(fieldnum(<ViewName>, ItemType));

   sysTableLookup.parmQuery(query);

   sysTableLookup.performFormLookup();

}

Reply
Suggested Answer

Just found this post while replying on another thread.

Here's the original blog post of mine about this class, the guy in the other blog post is a shameless copy/paster :(

kashperuk.blogspot.dk/.../sysmultitableloookup-dynamic-lookups.html

Reply
Stefan Hofmaninger responded on 30 Oct 2015 5:52 AM
My Badges
Verified Answer

Hi,

I think this class is not standard in AX 2012 -> I have also downloaded this class as an xpo an made a few corretions in the code.
Here's a link where you can download the class:

http://axbooster.blogspot.co.at/2014/05/lookup-from-multiple-table-ax-2009.html

Regards

Stefan

Reply
Kauto responded on 3 Nov 2015 4:17 AM
My Badges
Verified Answer

I came across this article on a post elsewhere - I have employed this mechanism to achieve what I need - it is actually very easy to do and makes sense.

It is actually very easy to combine multiple datasources in a sysTableLookup. Here is the trick I used to be able to filter on the name from the EcoResProductTranslation in the lookup for items.

1) Create a view that combines all your datasources and add the fields you would like to see in your lookup to the view.

2) Create a query from the view created in step 1.

3) Use these to perform your lookup as follows...

static client void lookupItemActive(FormStringControl _ctrl)

{

   SysTableLookup sysTableLookup = SysTableLookup::newParameters(tablenum(<ViewName>),_ctrl);

   Query          query = new Query(queryStr(<QueryName>));

   sysTableLookup.addLookupfield(fieldnum(<ViewName>, ItemId));

   sysTableLookup.addLookupfield(fieldNum(<ViewName>, Name));

   sysTableLookup.addLookupfield(fieldNum(<ViewName>, ItemGroupId));

   sysTableLookup.addLookupfield(fieldnum(<ViewName>, Status));

   sysTableLookup.addLookupfield(fieldnum(<ViewName>, RevId));

   sysTableLookup.addLookupfield(fieldnum(<ViewName>, ItemType));

   sysTableLookup.parmQuery(query);

   sysTableLookup.performFormLookup();

}

Reply
Suggested Answer

Just found this post while replying on another thread.

Here's the original blog post of mine about this class, the guy in the other blog post is a shameless copy/paster :(

kashperuk.blogspot.dk/.../sysmultitableloookup-dynamic-lookups.html

Reply

SBX - Two Col Forum

SBX - Migrated JS