ITPub博客

首页 > 应用开发 > IT综合 > 【BO-SDK】-(RAS) Using the RAS SDK in BusinessObjects Enterprise_@old_devlib_01

【BO-SDK】-(RAS) Using the RAS SDK in BusinessObjects Enterprise_@old_devlib_01

原创 IT综合 作者:xiangjinling 时间:2010-09-20 21:06:41 0 删除 编辑
managed scenarios: simple for modify[@more@]

String username = "Administrator";
String password = "***";
String cmsName = "***:6400";
String authType = "secEnterprise";

IInfoObjects oInfoObjects=null;
IInfoObject oInfoObject=null;

IEnterpriseSession boEnterpriseSession;
Fields resultFields = null;
ReportClientDocument myClientDocument=null;
try {
boEnterpriseSession = CrystalEnterprise.getSessionMgr().logon( username, password, cmsName, authType);
IInfoStore boInfoStore = (IInfoStore) boEnterpriseSession.getService("", "InfoStore");
IReportAppFactory myReportfactory=(IReportAppFactory)boEnterpriseSession.getService("RASReportFactory");

oInfoObjects = (IInfoObjects) boInfoStore.query("Select * from CI_INFOOBJECTS Where " +
"SI_ID='682627' And SI_INSTANCE=0" ); //681785
oInfoObject = (IInfoObject) oInfoObjects.get(0);
myClientDocument = myReportfactory.openDocument(oInfoObject, 0, Locale.ENGLISH);

//Tables
Tables retreivedTables = myClientDocument.getDatabaseController().getDatabase().getTables();
ITable table=retreivedTables.getTable(retreivedTables.findByAlias("ZBPBI131_INFO_WHOISWHERE"));

//for(int j=0;j// System.out.println(table.getDataFields().getField(j).getName());
//}

// Finds the field in the table:
int fieldIndex = table.getDataFields().find(fieldPartName, FieldDisplayNameType.fieldName, Locale.ENGLISH);
IField myfield=table.getDataFields().getField(fieldIndex);

// Find all Fields in a Report:
resultFields=myClientDocument.getDataDefController().getDataDefinition().getResultFields();

Fields usedFields = new Fields();
IField ifield=null;
for(int i=0;iSystem.out.println("DisName:"+resultFields.getField(i).getDescription());
System.out.println("LongName:"+resultFields.getField(i).getLongName(Locale.ENGLISH));
System.out.println("Name:"+resultFields.getField(i).getName());
System.out.println("Kind:"+resultFields.getField(i).getKind());
if(resultFields.getField(i).getName().equals("PTRV_HEAD-ZORT1")){ifield=resultFields.getField(i);}
if(resultFields.getField(i).getKind()==FieldKind.DBField){
System.out.println("DisName:"+resultFields.getField(i).getDescription());
System.out.println("Name:"+resultFields.getField(i).getName());
usedFields.addElement(resultFields.getField(i));
}
}
//Adds and Removes用ResultFieldController
myClientDocument.getDataDefController().getResultFieldController().remove(ifield);
//IField ifield2=null;
//ifield2.setName("PTRV_HEAD-ZOR77");
//myClientDocument.getDataDefController().getResultFieldController().add(-1,ifield2);//-1表示添加到最后


myClientDocument.save();
//closeReport(myClientDocument,boEnterpriseSession);

}catch (ReportSDKException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}catch (SDKException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

RAS SDK

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/24167472/viewspace-1038650/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2010-06-29

  • 博文量
    19
  • 访问量
    26370