on 10-20-2006 2:29 PM
Dear MI gurus,
Are there any resources (documents, blogs, forum topics, etc.) for learning how to use the JQuery APIs, that is, JQuery, JQueryAttribute, JQueryParameter, JQueryCondition, JQuerySortOrder, JQueryGroupBy, JQueryFactory, JQueryResult?
The only resource I'm aware of is the Java Doc. But that only gives low-level descriptions of the individual classes and their methods, with no higher-level description of how to put these pieces together to implement queries.
The MDK documentation only seems to cover queries using the syncBoQueryFactory family, not JQuery. My understanding is that these classes are more suited for file-based persistence and that the JQueryFactory classes are more for database persistence.
I've searched this forum and did not find anything. Thanks in advance for any pointers you can provide.
Best regards,
Kelly
hello kelly,
the JQuery APIs don't differ that much with the old Query
APIs in terms of their design i.e. factory pattern. interfaces
are named in terms of their use in the SQL context; this
way it is very easy to connect the dots...
with JQuery, you can join some fields of a child row and
its parent SyncBo toprow, and/or another field of different
row (top/child) of different SyncBo. as had been posted,
you can refer to MDK and also with the javadoc's method
description.
i had been thinking of writing a tutorial on this but
couldn't find some time... perhaps SAP MI client developers
can give a better document on this.
anyway, playing with code is the best way to get to
understand them... good luck.
jo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jo,
Thanks for your reply. A tutorial would be great. Given the quality of your other postings and blogs, I'm sure it would be most excellent.
Here is a utility method I wrote that works for our project. Feel free to offer suggestions. Sorry about the indentation being off.
/*****************************************************************************
getSyncBoInstances (JQuery version)
Get the instances of a particular syncBO, based on the JQuery style.
This method returns an MeIterator that contains the results of the query
created by the condition, and array of fields passed in. The individual
instances returned from iterating the result set are JQueryResultRow
instances.
This version can only be used with database persistence, not file-based.
This version allows you to do join queries.
*
The following code fragment shows how to use this method and its results:
int firstRecord = 0;
MeIterator resultsIterator = dbAccess.getSyncBoInstances (
sortIndex, queryConditions, queryFields, firstRecord,
RETURN_ALL_RECORDS);
while (resultsIterator.hasNext()) {
JQueryResultRow resultRow =(JQueryResultRow) resultsIterator.next();
// Get field values from the row.
String matNo = dbAccess.getFieldValueByName (
resultRow, queryFields, "MATNR");
... more code...
}
@param sortIndex - Attribute / field / column number to on which to sort.
This specifies an index into the <i>queryFields</i> array, indicating
the field on which to sort.
@param condition - Query condition. Specify a value of null to return all
syncBO instances.
*
@param queryFields - SyncBO fields to return from the query. This can be
creating using the getAllQueryItems() method in this class.
@param startIndex - Index of first record to return (0-based).
@param maxRecordsToRetrieve - Maximum number or records to retrieve
(RETURN_ALL_RECORDS to return all records).
@return An iterator (MeIterator instance) that can be used to iterate the
result set. The iterator returns JQueryResultRow instances.
*****************************************************************************/
public static final int RETURN_ALL_RECORDS = -1;
public MeIterator getSyncBoInstances (int sortIndex, JQueryCondition condition,
JQueryAttribute[] queryFields, int startIndex, int maxRecordsToRetrieve)
{
MeIterator iteratorSyncBos = null;
try {
SmartSyncRuntime ssr = SmartSyncRuntime.getInstance();
SmartSyncJQueryFactory jQueryFactory = ssr.getJQueryFactory();
// Create the sort order based on the sort index.
JQuerySortOrder jSortOrder = jQueryFactory.createSortOrder (queryFields[sortIndex]);
// Create and execute the query.
JQuery query = jQueryFactory.createQuery (queryFields, condition, jSortOrder);
if ( query != null) {
queryResult = dataFacade.executeQuery (query, startIndex,
maxRecordsToRetrieve);
iteratorSyncBos = queryResult.iterator();
}
}
catch (Exception ex) {
Logger.logException ("getSyncBoInstances Error", ex);
}
return iteratorSyncBos;
} // getSyncBoInstances (JQuery version)
Message was edited by: Kelly Mulheren
Hello Kelly,
Found something in the help in SNDS.
In the Search type "JQUERY" and click go. In the results click on "Persistance". Alomost at the bottom is a link "JQuery code snippet. Click on this link and the example is shown. That's all what I can find.
Regards,
P. Willems
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.