Buscar este blog

miércoles, 26 de febrero de 2014

FORMULARIOS



For para recorrerse el DataSource
for (recordERComEmpl = ERComEmpl_ds.getFirst(true) ?  ERComEmpl_ds.getFirst(true) : ERComEmpl ;
                 recordERComEmpl;
                 recordERComEmpl =ERComEmpl_ds.getNext())

Para acceder a cualquier campo del formulario utilizamos


DATASOUCE_DS.object(fieldnum(,)).PROPIETIES.  
Ejemplo:
AssetBook_ds.object(fieldnum(AssetBook, Status)).allowEdit(false);


Create a Dialog
A dialog in Microsoft Dynamics AX is a simple form with a standardized layout, created by using the Dialog system class.
Dialogs should allow users to enter some simple values. Do not create complex dialogs—create forms instead.
Dialogs are non-modal. The dialog should not open a secondary window that requires user interaction. All user interaction should be carried out within the dialog.
Following are some of the most commonly used methods in the Dialog class:
  • Use the addField method to add fields to the dialog. The addField method returns objects of the DialogField type.
  • Use the addGroup method to group related fields.
  • Use the addTabPage method to add tabbed pages.
  • Use the value method to set and get values in the dialog.
  • Use the run method to launch the dialog. When the user clicks OK or Cancel, the run method returns true or false, respectively.
Dialog is the main class used to construct dialogs. DialogRunBase is an extension of the Dialog class that is used by the RunBase framework. TheDialogControl class defines a single control in the dialog. DialogControl is extended by classes for the following control types:
  • DialogField
  • DialogGroup
  • DialogTabPage
  • DialogText
  • DialogWindow
Aa877843.PATNDIAG(en-US,AX.10).gif
The following code sample implements the dialog shown in the previous figure.ç
boolean myDialog(str FromChequeNum="1000", str NumOfCheque="300")
{
    Dialog dialog = new Dialog("@SYS23133");
    DialogField dialogAccountId = dialog.addField(typeid(BankAccount));
    DialogField dialogFromChequeNum = dialog.addField(
        typeid(BankChequeStartNum),
        "@SYS4083");
    DialogField dialogNumOfCheque = dialog.addField(
        typeid(BankChequeQty),
        "@SYS14578");
    ;
    dialogAccountId.Value("456");
    dialogAccountId.Active(false);
    dialogFromChequeNum.Value(FromChequeNum);
    dialogNumOfCheque.Value(NumOfCheque);
    if (dialog.run())
    {
        FromChequeNum = dialogFromChequeNum.Value();
        NumOfCheque = dialogNumOfCheque.Value();
        return true;
    }
    return false;
}
 

INFORMES



Métodos para mostrar el report:
-   Element.printJobSettings().setTarget(PrintMedium::Screen);                //Por pantalla

-   Element.printJobSettings().setTarget(PrintMedium::PrintArchive);     //Por impresora directo



element.printJobSettings().SuppressScalingMessage(true);



Lanzar el informe sin crear el Menú Item
    /* Desde por ejemplo una clase llamamos a un informe */
public void run()
{
    ReportRun  reportRun;

    ;
    super();

    this.calcPrincipal();  //Calculo e inserto cargo la temporal que muestra en el informe.

    args = new Args();
    args.caller(this);
    //new MenuFunction(MenuItemOutputStr(ERPartialChargesRep), MenuItemType::Output).run(args);

    args.name(reportstr(ERPartialChargesRep));
    args.caller(this);
    reportRun = classfactory.reportRunClass(args);
    reportRun.run();
}





Informe con fetch anulado

public boolean fetch()
{
    boolean ret;
    Query                       q;
    QueryBuildDataSource        qbds;
    QueryRun                    qr;
    ;

    querybuilddatasource = this.query().dataSourceNo(1);
    if(querybuilddatasource.findRange(fieldnum(ERTmpItemByOfer,Dim)).value())
        rangeDim = querybuilddatasource.findRange(fieldnum(ERTmpItemByOfer,Dim)).value();

    if(querybuilddatasource.findRange(fieldnum(ERTmpItemByOfer,ConfigGroupId)).value())
        rangeConfigGroupId = querybuilddatasource.findRange(fieldnum(ERTmpItemByOfer,ConfigGroupId)).value();

    if(querybuilddatasource.findRange(fieldnum(ERTmpItemByOfer,ItemIdOfer)).value())
        rangeLookupOffers = querybuilddatasource.findRange(fieldnum(ERTmpItemByOfer,ItemIdOfer)).value();


    this.setQuery();

    //q = new Query();
   // qbds = q.addDataSource(tablenum(ERTmpItemByOfer));
    querybuilddatasource.addSortIndex(indexnum(ERTmpItemByOfer,SessionIdx));
    querybuilddatasource.indexIsHint(true);
    querybuilddatasource.addRange(fieldnum(ERTmpItemByOfer,CreatedBy)).value(curuserid());
    querybuilddatasource.addRange(fieldnum(ERTmpItemByOfer,SessionId)).value(queryvalue(SessionId()));
    qr = new QueryRun(this.query());
    while(qr.next())
    {
        ERTmpItemByOfer = qr.get(tablenum(ERTmpItemByOfer));
        element.send(ERTmpItemByOfer);
    }

    return true;
}