Thursday 23 March 2017

How to make a form from temp table AX 2012

1. Says I have 2 tables and one form

TestForm - a form  made out of temporary table I will have a grid
Test Table  - temp table
Table 1  - regular table with data inserted


Data  in table 1

now we dont have data in test table as it is a temp table, so there will be no data in the form too.


now in form int method we have


insert method as

Now when we open the form we will get the form as:

//Here we have to insert the data
Or you can also do like :


dont return a value

write the inserttemp method as

void inserttemp()
{
    //TestTable   TestTableloc;
    Table1      Table1;          
   
    while select  Table1
    {
        TestTable.age = Table1.age;
        TestTable.insert();
    }
   
    //return TestTableloc;
}

Please make sure TestTable is a form datasource not table buffer

and in init

public void init()
{


    super();
    element.inserttemp();
 
}

Wednesday 15 March 2017

Disable (alt + f 9 button from the list of purchase order list page

Some times we need to enable or disable certain button based  on certain criteria

class >> PurchTableListPageInteraction>>
method name >> public void selectionChanged()

declare

FormDataSource      purchTable_ds;



    super();


     purchTable_ds = this.currentPurchTable().dataSource();
    //PurchTable.DmsIsIntegrate == DmsIsIntegrate::None &&
    if(PurchTable.PurchStatus != PurchStatus::Invoiced || PurchTable.PurchStatus != PurchStatus::Backorder)
    {
        this.listPage().actionPaneControlEnabled(formControlStr(PurchTableListPage,EditButton),true);

     

        if(PurchTable.InterCompanySalesId != "")
        {
            purchTable_ds.allowDelete(false);
        }
        else
        {
            purchTable_ds.allowDelete(true);
        }
        purchTable_ds.allowEdit(true);
    }
    else
    {
        this.listPage().actionPaneControlEnabled(formControlStr(PurchTableListPage,EditButton),false);
        purchTable_ds.allowDelete(false);
        purchTable_ds.allowEdit(false);
    }

intercompany PO multiple product receipt by x++

public void processStampICPO(PackingSlipId _deliveryNote,                             Transdate _deliverydate,                             ...