MboSetRemote mboset = getMboSet("ASSET"); MboRemote asset = mboset.getMbo(0); String assetnum = asset.getString("ASSETNUM"); String assetdesc = asset.getString("DESCRIPTION"); int assetPriority = asset.getInt("PRIORITY");Rather than retrieving data from attributes individually you can use the getMboValueData(String[]) method to retrieve several attributes in a single call.
String[] attrs = { "ASSETNUM", "DESCRIPTION", "PRIORITY" }; MboSetRemote mboset = getMboSet("ASSET"); MboRemote asset = mboset.getMbo(0); MboValueData[] valData = asset.getMboValueData(attrs); String assetnum = valData[0].getData(); String assetdesc = valData[1].getData(); int assetPriority = valData[2].getDataAsInt();
String[] attrs = { "ASSETNUM", "DESCRIPTION", "PRIORITY" }; MboSetRemote mboset = getMboSet("ASSET"); MboValueData[][] valData = mboset.getMboValueData(0, 10, attrs); String assetnum0 = valData[0][0].getData(); String assetdesc0 = valData[0][1].getData(); int assetPriority0 = valData[0][2].getDataAsInt(); String assetnum1 = valData[1][0].getData(); ...The first parameter of getMboValueData method is the starting position of the required Mbo in the MboSet. The second parameter is the number of Mbos required. Passing MboConstants.ALLROWS the entire MboSet is retrieved.
Labels: advanced, java, mbo, performance