Skip to content

Commit

Permalink
Updated DatabaseAPI documentation. Re: Reylan Reyes
Browse files Browse the repository at this point in the history
  • Loading branch information
filiphakansson1 committed Jun 26, 2024
1 parent 116396f commit 0edb049
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions docs/documentation/api-specification/database-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,15 @@ void readRecord() {
### Read multiple records
To read multiple records a database action should be defined along with a `Closure<?>` that defines how each read record
will be processed/used.
When reading multiple records, the 'readAll' function including 'pageSize' should be used. 'pageSize' is referred to as 'nrOfRecords' in the examples below.
When reading multiple records, the 'readAll' function including 'pageSize' should be used. 'pageSize' is referred to as 'nrOfRecords' in the examples below. Ten thousand records is the recommended maximum value of pageSize.

Example:

Read all items with status 20 in a specific company and perform an action on each found record

```groovy
void handleReleasedItems() {
int nrOfRecords = mi.getMaxRecords() <= 0 || mi.getMaxRecords() >= 10000? 10000: mi.getMaxRecords();
int currentCompany = (Integer)program.getLDAZD().CONO;
DBAction query = database.table("MITMAS")
.index("20")
Expand All @@ -115,7 +116,7 @@ void handleReleasedItems() {
DBContainer container = query.getContainer();
container.set("MMCONO", currentCompany);
container.set("MMSTAT", "20");
query.readAll(container, 2, releasedItemProcessor);
query.readAll(container, 2, nrOfRecords, releasedItemProcessor);
}
Closure<?> releasedItemProcessor = { DBContainer container ->
Expand Down Expand Up @@ -231,8 +232,7 @@ void deprecateItems() {
container.set("MMCONO", currentCompany);
container.set("MMSTAT", "20");
int nrOfKeys = 2;
int nrOfRecords = mi.getMaxRecords() <= 0 || mi.getMaxRecords() >= 10000? 10000: mi.getMaxRecords();
query.readAllLock(container, nrOfKeys, nrOfRecords, updateCallBack);
query.readAllLock(container, nrOfKeys, updateCallBack);
}
Closure<?> updateCallBack = { LockedResult lockedResult ->
Expand Down

0 comments on commit 0edb049

Please sign in to comment.