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

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博客 ” ,链接:http://blog.itpub.net/24167472/viewspace-1038650/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/24167472/viewspace-1038650/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值