How to create a lookup form

Hi,

i have created a new table and i want create a combobox to show lookup form that display all data of my new table.

Regards,

You don’t have to create your own lookup form; AX can do it for you according to a table relation.

Please tell us your version of AX (and don’t forget to always mention the version, preferably by adding a tag). The exact solution differs in AX 2012 and older versions.

Thank you for replay ;

I m using ax2012 R2,

When you create a new table, it has PrimaryKey = SurrogateKey. Leave it as it is.

Create a field with a human-readable identification and add it to a new index. Set the index with AllowDuplicates = No and AlternateKey = Yes. Set the index to the ReplacementKey property of your table.

Create a new data type representing a reference to the surrogate key. Type = Int64, Extends = RefRecId, ReferenceTable = {your table name}.

In a form, add a ReferenceGroup control and set ExtendedDataType = {your EDT name}. You’re done! AX will create a lookup for you.

There is much more what you can do, of course. For example, you can change the field group used by the ReferenceGroup control. Please refer to AX documentation for more information.

Thank you for replay ,

I have difficulty to create lookup , that’s what I did :

  1. I create new table ‘reference’ with field ‘RefID’

2.create new index ‘indexRef’ with AllowDuplicates = No andAlternateKey = Yes. Set the index to the ReplacementKey property of your table.

3.Add ‘RefID’ to index ‘indexRef’

  1. Create a EDT ‘refEdt’ and i set reference table property to my table

5.create new form "Lookupform " i add in datasource my new table

6.In design node i add 2 dateEdite control and i add datasource and data field property

7.In design node i add combobox control i add datasource property

8;i add ReferenceGroup control with datasource property , but i can’t set ExtendedDataType = {my EDT name} is not displayed

any ideas to improve my Testof lookup

best regards

Please read my instructions again - there is nothing about adding data sources and such things. I think you didn’t get that the whole lookup will be generated by AX according to the elated table and the replacement field group.

Look again for the ExtendedDataType property - it’s more likely that you overlooked it or you used a wrong control than that the property just disappeared.