Jan 22, 2012

How to create EDT ?


How create Extended Data Types in AOT : EDT’s are User Defined Datatypes which are extended by another Datatypes or another EDT

·         Go to AOT àData Dictionaryà Extended Data Types àNew Data Types


·         Go to Properties of the New EDT and set the properties.

Relations in EDT :

·         If we want to reuse the the values of parent table field in child tables field then we can create a relation on EDT to that particular field of parent table .
·         By extending this EDT in a same type of field in child table then the values from parent table field should come in look up of child tables field.

At  EDT Level we have the following relations

·         Normal

EDT == table.field ;

·         Related Field Fix

How to create table


How to create a table in AOT :

·         Select  Data Dictionary à select Tables



  •          Right Click àSelect New TableàRight on the New Table Click àSelect Properties and set the properties
  •       Expand the Table à select Fields à right click àselect required data type for that particular field and set        properties
  •           You can also drag and drop the existing fields from another tables



Notes:

  •          The properties marked with bold text have been changed specifically for the selected element.
  •           The pink background that you will see in the Name property means that it is mandatory








How to create dialog and how to filter on dialog values of the report


   public class ReportRun extends ObjectRun
   {
   TransDate                           startDate , endDate;
   DialogField                         dialogfield1,dialogfield2;
   MyTable                             myTable;

    #define.CurrentVersion(2)
    #localMacro.CurrentList
        startDate,
        endDate
    #endMacro 
   }

   public Object dialog(Object _dialog)
  {
    DialogRunbase dialog = _dialog;
    ;
    dialog.caption('Dialog for date details');
    dialog.addGroup('Period :');
    dialogfield1 = dialog.addField(typeid(Transdate),'From date');
    dialogfield1.value(startDate);
    dialogfield2 = dialog.addField(typeid(Transdate),'To date');
    dialogfield2.value(endDate);
    return dialog;
  }


boolean getFromDialog()
{
    ;
    startDate   =   dialogfield1.value();
    endDate     =   dialogfield2.value();
    return true;
}


public container pack()
{
    return [#CurrentVersion, #CurrentList];
}


public boolean unpack(container _packedClass)
{
    Version version = RunBase::getVersion(_packedClass);
    switch (version)
    {
        case(#CurrentVersion) :
            [version, #CurrentList] = _packedClass;
            break;
        default :
            return false;
    }
    return true;
}


public boolean fetch()
{
    boolean ret;
    ;
    ret      = super();
   queryRun = new QueryRun(this);
   //queryRun.query().clearBaseQueries();
   queryRun.query().addDataSource(tablenum( myTable )).addRange(
                    fieldnum( myTable ,mydateField)).value(queryRange(startDate,endDate));
   return  true;
}





How to create dynamic column in a report



    container                                    projectId , projectIdLabel , projCon;
    MyTable                                    externalTable ;
    ProjTable                                   ProjTable ;
    ReportTextControl                      reportText , custName ;
    ReportPromptControl                 headerPrompt1 , headerPrompt2 , headerPrompt3 ;
    ReportSection                            bodySection , bodyHeaderSec ;
    int                                               i;
   CustTable                                   custTable ;


public void executeSection()
{

    int    i;
    ;
    super();

    bodyHeaderSec = element.report().design().addProgrammableSection(2);
    bodyHeaderSec.leftMargin(2,Units::char);
    bodyHeaderSec.bottomMargin(1.5,units::char);



    bodySection = element.report().design().addProgrammableSection(1);
    bodySection.leftMargin(2,Units::char);
    custName = bodySection.addControl(tableNum(CustTable),fieldNum(CustTable,AccountNum));
    custName.name('CustNameLabel');

    headerPrompt1 = bodyHeaderSec.addPromptControl(tablenum(CustTable));
    headerPrompt1.label('Customer name');
    headerPrompt1.modelFieldName(custName.name());

    i = 0;

    while select count(ProjId) from externalTable group by  externalTable.CategoryId
                                              join ProjTable
                                              where  externalTable. ProjId == ProjTable.ProjId
                                              &&  ProjTable.CustAccount == custTable.AccountNum

        {
            if( externalTable .CategoryId)
            {
            i++;
            projectId  =  conins(projectId,i, externalTable . ProjId) ;
            reportText =  bodySection.addTextControl(conpeek(projectId,i));
            reportText.width(6,units::char);
            projCon = conins(projCon, i ,'ProjIdCountLabel' + int2str(i));
            reportText.name('ProjIdCountLabel'+int2str(i));

            projectIdLabel = conins(projectIdLabel,i,'FAM'+ int2str(i));
            headerPrompt2 = bodyHeaderSec.addPromptControl(tablenum( externalTable ));

            headerPrompt2.label(conpeek(projectIdLabel,i));
            headerPrompt2.modelFieldName('ProjIdCountLabel'+int2str(i));

            }

        }

    bodyHeaderSec.executeSection();
    bodySection.executeSection();

}