19 April 2012

Add a single postal location to an ax 2012 form


To add a single postal address to a form with the new ActionPane there are several steps to do:

  1. Add the EDT LogisticsLocationRecId to the table where the new postalAddress should be added
  2. Add this table to the LogisticsLocationMap and create a Mapping: LogisticsLocationMap.Location ==  theNewTable.LogsticsLocationRecId
  3. Add the LogisticsPostalAddress Table to the Form

  4. Paste the following code to the form:

    public class FormRun extends ObjectRun
    {
        LogisticsPostalAddressFormHandler  addressController;
    }


    public void init()

    {
          super();
            addressController =
        LogisticsPostalAddressFormHandler::newParameters(newTable_ds, logisticsPostalAddress_ds);

              addressController.callerUpdateQuery(fieldNum(newTable, LogisticsLocationRecId));
          }

          public LogisticsPostalAddressFormHandler getAddressController()
          {   
              return addressController;
          }
        1. Place an ActionPane to your form with the MenuItemButtons New/Edit/Clear/Map.
          The easiest way to do this is to copy and paste it from the BankAccountTable form.

        2. Add this Code to the active method of the main DS:

          public int active()
          {
              int ret;

              ret = super();

              if (ret)
              {
                  addressController.callerActive();
                  addressController.callerUpdateButtons(newAddress, editAddress, clearAddress, mapButton);
              }

              return ret;
          }
        3. after that synchronize table and map and than try to open the form ;)




        11 April 2012

        Problems with ordering grid columns

        If there are problems with the ordering of grid columns of a grid inside a tab although the AllowUserSetup of the form is set to Yes. Check if the method tabChanged of the tab control is overwritten. Overwriting this method can cause problems with the re-ordering.
        Instead of using the TabChanged on the tab control move the code to the pageActivated method of the TabPage.