if (idJDBReturn == JDEDB_PASSED) { idJDBReturn = JDB_FetchAggregate(hRequest, (void *)NULL, dsAggregateBuffer); /* 5. Return max value to mnLineNumber */ MathCopy(&lpDS->mnLineNumber, &dsAggregateBuffer[0]); } } } if (hRequest != (HREQUEST)NULL) { JDB_CloseTable(hRequest); }
Alternative Methods:
An alternative method is to create a Named Event Rule (NER) business function or event rules within a Report which may yield the same result.
A. WHILE LOOP - The last row
mnInputDOC szInputDCT mnOutputLNID_Last
/* The last row from data which meets select test */ VA evt_LineNumber_last = "0" F4111.Select (Case (order by Primary Key UKID Ascending)) VA mnInputDOC = TK Document (Voucher, Invoice, etc.) VA evt_szInputDCT = TK Document Type F4111.Fetch Next VA mnOutputLNID_Last <- TK Line Number While SV File_IO_Status is equal to CO SUCCESS F4111.Fetch Next mnOutputLNID_Last <- TK Line Number End While
B. Select/Fetch Next - to get the 1st row /* choose/create index which is descending order of data */ VA evt_LineNumber_last = "0" F4111.Select (Case (order by Foreign Key UKID Descending)) VA mnInputDOC = TK Document (Voucher, Invoice, etc.) VA evt_szInputDCT = TK Document Type If SV File_IO_Status is equal to CO SUCCESS F4111.Fetch Next (same index with SELECT) VA evt_LineNumber_last <- TK Line Number End If
Or, make use of Aggregation option through Report Design Aid within a Level Break Footer. Refer to <Note 636697.1> - E1: RDA: Aggregate Function in Level Break Footer
Note:
Above example codes are sample only. Oracle does not provide any warranty on these samples and is not responsible for any bug or any issue resulting from these samples.
User should search in the source folder for "JDB_SetAggregate" to find all standard EnterpriseOne business functions that uses this API and study how this API is used. (E.g. b4120330 uses this API)