Adding tables to forms based on queries (List pages)

Form based on a query in the datasource cannot show new tables added to the query. All though the added datasource is visible in the query on the form it is not included in the list of available datasources from which you can drag’n’drop fields into the grid.

To make that happen you need to do a little massaging of the form outside AX.

Export the form and edit the export file in Notepad. Locate the definition of the datasources and add the following text (remember to change the name and table to whatever fits your current situation).

The text should be inserted immediately after the other data source objects and before the derived data source objects:

   DATASOURCE

      OBJECTPOOL
        PROPERTIES
          Name                #<DatasourceName>
          Table               #<TableName>
          AllowEdit           #No

          AllowCreate         #No
          AllowDelete         #No
          OnlyFetchActive     #Yes

        ENDPROPERTIES

        FIELDLIST

        ENDFIELDLIST

      ENDOBJECTPOOL

      METHODS

      ENDMETHODS

      LINKTYPES

        DATASOURCE

          PROPERTIES

            Name                #<DataSourcename>

            ParentDataSource    #<ParentDatasourceName>

          ENDPROPERTIES

      ENDLINKTYPES

    ENDDATASOURCE
Save the file and import it into AX.
It is not pretty but it works. 🙂
Advertisements

One thought on “Adding tables to forms based on queries (List pages)

  1. Hi Søren,

    Thank you for the interesting blog. I found a post about joins and then read other posts 🙂

    There is an alternative solution.
    1. Select “Data sources” node in the form
    2. Open AOT properties
    3. Select Query property and press Enter
    4. Datasources are updated.

    Best regards,
    Oleg

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s