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 ;)




        1 comment:

        Unknown said...

        Hi,

        I have a requirement in which I have to add a new address tab on the "BankAccountTable" form called “Correspondet Bank address” below the standard address Tab. It means a bank will have or can have two addresses, its own address and correpondent bank address.

        Can you please suggest how to achieve it ?


        Regards
        Anuj