BSSV Query or Select Table I/O Tutorials

jefrey

Active Member
Hello Listers,

Anyone knows any Hands-on Labs, tutorials or guides on how to create BSSV for Select Table I/O?

Help is much appreciated.

Thanks,
Jefrey
 

jefrey

Active Member
Hi Alfre,

Thanks for the reply but that document is for "Insert" BSSV. What I need is "Select" BSSV :(

Jefrey
 

johndanter

Legendary Poster
Try changing diagram 6 to Select vs Insert :)

Or if you can't get your head around it, just clone the wrapped BSFN methodology and create a BSFN yourself to select the record for you based on a key you pass in via the request VO (input) and map the columns all the way back out to the confirm VO (output)
 

alfredorz

Well Known Member
Hi friend!

I add a example. I read from table and add to ArrayList in a method:

/**
* Selects records from the F55XXXXX table.
* <p>Following SQL statement can be produced by this generated code
* <blockquote><pre><code>
* SELECT F55XXXXX.UKID, F55XXXXX.DOC, F55XXXXX.DCT, F55XXXXX.IDROW, F55XXXXX.MCU, F55XXXXX.ITM, F55XXXXX.LITM, F55XXXXX.LOCN, F55XXXXX.LOTN, F55XXXXX.MMEA, F55XXXXX.QTY, F55XXXXX.UM, F55XXXXX.DTAI
*
* FROM F55XXXXX
*
* WHERE F55XXXXX.UKID=? AND F55XXXXX.DOC=? AND F55XXXXX.DCT=?
*
*/
private static ArrayList selectFromF55XXXXX(IContext context,
IConnection connection,
keyF55XXXXX internalVO) {
//create return object
E1MessageList returnMessages = new E1MessageList();
ArrayList queryResults = new ArrayList();


//specify columns to select
BSSVDBField[] selectFields =
{ new BSSVDBField("F55XXXXX.UKID"), // Numeric - UniqueKeyIDInternal
new BSSVDBField("F55XXXXX.DOC"), // Numeric - DocVoucherInvoiceE
new BSSVDBField("F55XXXXX.DCT"), // String - DocumentType
new BSSVDBField("F55XXXXX.IDROW"), // Numeric - IDRow
new BSSVDBField("F55XXXXX.MCU"), // String - CostCenter
new BSSVDBField("F55XXXXX.ITM"), // Numeric - IdentifierShortItem
new BSSVDBField("F55XXXXX.LITM"), // String - Identifier2ndItem
new BSSVDBField("F55XXXXX.LOCN"), // String - Location
new BSSVDBField("F55XXXXX.LOTN"), // String - Lot
new BSSVDBField("F55XXXXX.MMEA"),
// String - DATELOTEXPIRATIONALPHA
new BSSVDBField("F55XXXXX.QTY"), // Numeric - Quantity
new BSSVDBField("F55XXXXX.UM"), // String - UnitOfMeasure
new BSSVDBField("F55XXXXX.DTAI") // String - DataItem
} ;


//specify sort order
BSSVDBSortField[] sortOrder = null;


//specify condition records must meet to be selected
BSSVDBWhereField[] whereFields =
{ new BSSVDBWhereField(null, new BSSVDBField("F55XXXXX.UKID"),
IDBService.EQUALS,
internalVO.getF55XXXXX_UKID()),
new BSSVDBWhereField(IDBService.AND, new BSSVDBField("F55XXXXX.DOC"),
IDBService.EQUALS,
internalVO.getF55XXXXX_DOC()),
new BSSVDBWhereField(IDBService.AND, new BSSVDBField("F55XXXXX.DCT"),
IDBService.EQUALS,
internalVO.getF55XXXXX_DCT()) };


BSSVDBWhereClauseBuilder whereClause =
new BSSVDBWhereClauseBuilder(context, whereFields);


BSSVDBResultSet resultSet = null;
boolean selectDistinct = false;


try {
//get dbService from context
IDBService dbService = context.getDBService();
//execute db select operation
resultSet =
dbService.select(context, connection, "F55XXXXX", IDBService.DB_TABLE,
selectDistinct, IDBService.DB_FETCH_ALL,
selectFields, sortOrder, whereClause);
} catch (DBServiceException e) {
//TODO take some action in response to the database exception
returnMessages.addMessage(new E1Message(context, "005FIS",
e.getMessage()));
}


//process the results of the select
if (resultSet != null) {
BSSVDBFieldMap[] fieldMap = resultSet.getFieldMap();
if (fieldMap != null && fieldMap.length > 0) {


for (int i = 0; i < fieldMap.length; i++) {
BSSVDBFieldMap map = fieldMap;
recordF55XXXXX result = new recordF55XXXXX();
result.setF55XXXXX_UKID((MathNumeric)map.getValue("F55XXXXX.UKID"));
result.setF55XXXXX_DOC((MathNumeric)map.getValue("F55XXXXX.DOC"));
result.setF55XXXXX_DCT((String)map.getValue("F55XXXXX.DCT"));
result.setF55XXXXX_IDROW((MathNumeric)map.getValue("F55XXXXX.IDROW"));
result.setF55XXXXX_MCU((String)map.getValue("F55XXXXX.MCU"));
result.setF55XXXXX_ITM((MathNumeric)map.getValue("F55XXXXX.ITM"));
result.setF55XXXXX_LITM((String)map.getValue("F55XXXXX.LITM"));
result.setF55XXXXX_LOCN((String)map.getValue("F55XXXXX.LOCN"));
result.setF55XXXXX_LOTN((String)map.getValue("F55XXXXX.LOTN"));
result.setF55XXXXX_MMEA((String)map.getValue("F55XXXXX.MMEA"));
result.setF55XXXXX_QTY((MathNumeric)map.getValue("F55XXXXX.QTY"));
result.setF55XXXXX_UM((String)map.getValue("F55XXXXX.UM"));
result.setF55XXXXX_DTAI((String)map.getValue("F55XXXXX.DTAI"));
queryResults.add(result);
}


}


}
}
return queryResults;
}






I hope could be useful for you.

Regards,
Alfre.
 
Top