Question Status

Suggested Answer
maram fraij asked a question on 23 Jan 2014 11:19 AM

Can I define many EDT with same relation but with different lookup format (the first one is standard directly returns Auto look up fields from the table , the other one use FormHelp property to return many tabs )  

Reply
Suggested Answer
Nitesh Ranjan responded on 23 Jan 2014 4:06 PM

Yes, you can do this.

There are many ways in which we can have lookup for a field

1) Auto lookup which utilizes Table relation setup

2) Override the lookup method on the form datasource field

3) Override the lookup method on the form control

4) create a lookup form and update the EDT FormHelp property

You can use above method to define many different lookup for EDTs

Please verify


Please update with your feedback.

Regards, NITESH RANAJN (PMP) | Dynamics AX Consultant

If this post helps you, Please verify this answer and earn Thank you Badge for yourself (Follow this link for more details https://community.dynamics.com/braggerbadges/badge/48.aspx)

Reply
Suggested Answer
Denis Macchinetti responded on 25 Jan 2014 9:21 AM

Hi

Here the code :

public void lookup()

{

   SysTableLookup          sysTableLookup  = SysTableLookup::newParameters(tableNum(ProjTable), This);

   Query                   query           = new Query();

   QueryBuildDataSource    queryBuildDataSource, Qbds2;

   QueryBuildRange         queryBuildRange;

   ;

   queryBuildDataSource    = query.addDataSource(tableNum(ProjTable));

   Qbds2 = queryBuildDataSource.addDataSource(tableNum(projStatusTypeRule));

   Qbds2.joinMode(JoinMode::InnerJoin);

   Qbds2.addLink(fieldNum(ProjTable, Type), fieldNum(projStatusTypeRule, ProjType));

   Qbds2.addLink(fieldNum(ProjTable, Status), fieldNum(projStatusTypeRule, ProjStatus));

   Qbds2.addRange( fieldNum( projStatusTypeRule, ProjStatusRule)).value(queryValue(ProjStatusRule::CreateCourse));

   sysTableLookup.parmQuery(query);

   sysTableLookup.addLookupfield(fieldNum(ProjTable,ProjId));

   sysTableLookup.addLookupfield(fieldNum(ProjTable,Name));

   sysTableLookup.performFormLookup();

}

Regards

Thanks & Regards

Denis Macchinetti

Senior Technical Architect

Reply
André Arnaud de Calavon responded on 23 Jan 2014 12:47 PM

Hi Maram,

Have a look at the warehouse lookup on a customer and the lookup for this same field on a order line. Is this like your requirement?

kind regards,

André Arnaud de Calavon  |  Microsoft Dynamics AX Solution architect  |  My blog  |  My company

This post is my own opinion and does not necessarily reflect the opinion or view of my company, Microsoft, both its employees, or other MVPs.

Reply
Suggested Answer
Nitesh Ranjan responded on 23 Jan 2014 4:06 PM

Yes, you can do this.

There are many ways in which we can have lookup for a field

1) Auto lookup which utilizes Table relation setup

2) Override the lookup method on the form datasource field

3) Override the lookup method on the form control

4) create a lookup form and update the EDT FormHelp property

You can use above method to define many different lookup for EDTs

Please verify


Please update with your feedback.

Regards, NITESH RANAJN (PMP) | Dynamics AX Consultant

If this post helps you, Please verify this answer and earn Thank you Badge for yourself (Follow this link for more details https://community.dynamics.com/braggerbadges/badge/48.aspx)

Reply
maram fraij responded on 25 Jan 2014 7:55 AM

I need to convert the below code segment to a lookup form by Override the lookup method on the control, can you help me how can I convert this to a

Query ??? note that create course is a customized rule added to project status rule enumeration.

while select  projTable JOIN projStatusTypeRule WHERE projTable.Type==projStatusTypeRule.ProjType && projTable.Status==projStatusTypeRule.ProjStatus && projStatusTypeRule.ProjStatusRule==ProjStatusRule::CreateCourse

{

 info (projTable.ProjId);

 info (projTable.Name);

}

Reply
Suggested Answer
Denis Macchinetti responded on 25 Jan 2014 9:21 AM

Hi

Here the code :

public void lookup()

{

   SysTableLookup          sysTableLookup  = SysTableLookup::newParameters(tableNum(ProjTable), This);

   Query                   query           = new Query();

   QueryBuildDataSource    queryBuildDataSource, Qbds2;

   QueryBuildRange         queryBuildRange;

   ;

   queryBuildDataSource    = query.addDataSource(tableNum(ProjTable));

   Qbds2 = queryBuildDataSource.addDataSource(tableNum(projStatusTypeRule));

   Qbds2.joinMode(JoinMode::InnerJoin);

   Qbds2.addLink(fieldNum(ProjTable, Type), fieldNum(projStatusTypeRule, ProjType));

   Qbds2.addLink(fieldNum(ProjTable, Status), fieldNum(projStatusTypeRule, ProjStatus));

   Qbds2.addRange( fieldNum( projStatusTypeRule, ProjStatusRule)).value(queryValue(ProjStatusRule::CreateCourse));

   sysTableLookup.parmQuery(query);

   sysTableLookup.addLookupfield(fieldNum(ProjTable,ProjId));

   sysTableLookup.addLookupfield(fieldNum(ProjTable,Name));

   sysTableLookup.performFormLookup();

}

Regards

Thanks & Regards

Denis Macchinetti

Senior Technical Architect

Reply