Monday, 22 December 2014

Delete Actions in Ax2012

there are 4 types of delete Action:

Say we have 2 tables A and B and both tables are having a relation 1:1 or 1:n;

a)None:

if we delete table A  then table B will not get deleted.
cascade:

b) if we delete table A then table B will be deleted.

restricted:

If we try to  delete table A it won't get deleted until there is a data in the table B which is related to Table A

cascade+rescrited:

say there is one more table C which is cascade to table A

so it is now:

table C--->cascade>>>tableA------rescrited----->tableB

then if we delete the data from c the respective data in table a and table b will deleted.


Sunday, 21 December 2014

method for finding duplicates in table

public static boolean existDuplicateName(MyTable _MyTable )
{
    MyTable MyTable ;

    select firstonly RecId from MyTable
        where MyTable .Name     == MyTable .Name &&
              MyTable .RecId    != MyTable .RecId;

    return (MyTable .RecId != 0);
}


the duplicates in the table may have same name but will have a different rec ID we can use thid functionality  to find the duplicates in the table.

intercompany PO multiple product receipt by x++

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