Tuesday, 27 October 2015


Find method in ax 2012 and usage
Find method in ax 2012:
1. Find method can be used for finding the data’s from outside the table using some relations.
2. Static keyword is very important in find method.
3. Tablename – means the return type of the find method. Here you can use table OR Field. But most of the cases we can use table as return type, so that we can get all the data’s from single find method.
4. OvertimereqId – Primary index field, based on this we can get the data. Here I used EDT of the index field.
 Example for the find method:
 static Tablename find(OvertimereqId   _OvertimereqId, boolean       _forUpdate = false)
{
    Tablename tablename;
    ;
     if (_OvertimereqId)
    {
        if (_forUpdate)
            tablename.selectForUpdate(_forUpdate);
         select firstonly tablename
            index hint ReqNoIdx
            where tablename.Requestno == _OvertimereqId;
    }
    return tablename;
}
 5. From the above code inside the find parameter we can specify multiple primary OR cluster index field as we want, but initially for update should be false.
6. For update is needed when all the indexes are in table, then we can allow the update.
7. We can use this method in multiple tables, display methods,assigning values to the other table.
 How to use the find method:
 8. In form level , table2 must have the same field.
            Anyfield = Tablename ::find(table2.OvertimereqId).name;
9. In display method also we can use the same code.
     EX:  
       display name getname()
      {
        return Tablename ::find(table2.OvertimereqId).name;
       }

No comments:

Post a Comment