Saturday, February 19, 2022

Parameter Form - Table of Content(TOC)

 1. Create Parameter table -> Cache Lookup (Entire Table) -> Table Type(Parameter).

2. Add the required fields.

3. Add a field Key and EDT type Parameter Keys, make visibility to false.

4. Create a unique index KeyIdx with Key field.

5. We need to create 4 methods

    a. Find

public static WHSVehicleParameters find(boolean _forupdate = false )

    {

        WHSVehicleParameters parameter;


        parameter.selectForUpdate(_forupdate);


        select firstonly parameter

index KeyIdx

            where parameter.Key == 0;


if(!parameter && !parameter.isTmp())

        {

            Company::createParameter(parameter);

        }

  

        return parameter;

    }

    b Exist

 public static boolean exist()

    {

        

        return ((select firstonly RecId from WHSVehicleParameters).RecId != 0);

    }

    c Update

  public void update()

    {

        super();

        flush WHSVehicleParameters;

    }

    d delete

    public void delete()

    {

        throw Error("Not Allowed");

    }

6. Create a new form and add data source

7. Make allowcreate, allowdelete, insert if empty and insert at end to false.

8. Select form pattern - Table of Content.

9. Follow the pattern control suggestion or as shown in below pic.

10. Override the init method of form and add the find code before super to create one record.

 public void init()

    {

        WHSVehicleParameters::find();

        super();

    }








 Build and Run

    


  

   


 



    

  


No comments:

Post a Comment

Sample Dialog Syntax - 1

 class AffiliationAutoAssignment extends RunBaseBatch {     // 1. Class Declaration and Pack variables     #define.CurrentVersion(1)     #de...