web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Find method

(0) ShareShare
ReportReport
Posted on by 210

Can Some one explain this code.

public static BankAccountTable find(
CompanyBankAccountId _companyBankAccountId ,
boolean _forupdate = false,
ConcurrencyModel _concurrencyModel = ConcurrencyModel::Auto)
{
BankAccountTable bankAccountTable;
;

bankAccountTable.selectForUpdate(_forupdate);
if (_forupdate && _concurrencyModel != ConcurrencyModel::Auto)
{
bankAccountTable.concurrencyModel(_concurrencyModel);
}

select firstonly
bankAccountTable
where
bankAccountTable.AccountID == _companyBankAccountId;

return bankAccountTable;
}

And give me some tips to write find and exist methods in simple way..

Thanks

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Denis Macchinetti Profile Picture
    16,444 on at
    RE: Find method

    Hi

    About concurrencyModel, you can find more info at msdn.microsoft.com/.../bb190073.aspx

    Usually, almost all the AX Tables have the OCCEnable Table property set to yes, including the bankAccountTable Table.

    Optimistic Concurrency Control (OCC) helps increase database performance because the records are locked from the time when the actual update is performed.

    About Find or Exist Methods, take a look at msdn.microsoft.com/.../aa672421.aspx and msdn.microsoft.com/.../aa879893.aspx

  • Verified answer
    Community Member Profile Picture
    on at
    RE: Find method

    Find()  method basiclly return a record selected as per parameter specifed

    this method is very handy while writing code

    and as per standard this method is available in each and every table.

    it is recommended to have this type of method in each customized table as per best practive of X++ coding

    it is recommended to select a record from a table using this method based on primary key of the table, so that method returns only one record at a time

    other parameters basiclly specifies the characteristics of the seleted record

    like _forUpdate Parameter basically specifies whether the selected record is for update purpose or not

    _concurrencyModel Parameter basically specified what will be the Optimistic Concurrency Control for the selected record

    Please follow following link for more details related to Optimistic Concurrency Control

    technet.microsoft.com/.../aa569634.aspx

    Same is the case for 'exist()' method, this method is also recommended to be written for each table

    this method is similar to find() method but it returns boolean value specifying whether record is available as per parameter or not.

    other parameters like _forUpdate and _consurrencyModel is not required.

    Please verify and let me know if you need more details

  • Suggested answer
    Hari.V Profile Picture
    210 on at
    RE: Find method

    Thanks Nitesh,

    I am very happy with your answer. It has very basic level information. If I need anything more I'll get back to you.

    Thank you so much.

  • Hari.V Profile Picture
    210 on at
    RE: Find method

    Thanks Denis...

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Tocauer Profile Picture

Martin Tocauer 4

#1
Community Member Profile Picture

Community Member 4

#3
Nayyar Siddiqi Profile Picture

Nayyar Siddiqi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans