连接参数
...
String reportName = "Sales Dashboard";
int reportID = 0;
// Logon and obtain an Enterprise Session
IEnterpriseSession boEnterpriseSession = null;
IInfoObjects boInfoObjects=null;
IInfoObject boInfoObject=null;
IInfoStore boInfoStore=null;
IReportSource boReportSource=null;
IReportSourceFactory boReportSourcefactoryPageServer=null;
try {
boEnterpriseSession = CrystalEnterprise.getSessionMgr().logon( username, password, cmsName, authType);
boInfoStore = (IInfoStore) boEnterpriseSession.getService("", "InfoStore");
//Query for the report and make sure that the report is an instance "SI_INSTANCE=0"
// boInfoObjects = (IInfoObjects) boInfoStore.query("Select * from CI_INFOOBJECTS Where " +
// "SI_NAME='" + reportName + "' And SI_INSTANCE=0" );
boInfoObjects = (IInfoObjects) boInfoStore.query("Select * from CI_INFOOBJECTS Where " +
"SI_ID='682627' And SI_INSTANCE=0" );
boInfoObject = (IInfoObject) boInfoObjects.get(0);
//SI_PROMPTS
IProperties prompts = (IProperties) boInfoObject.getProcessingInfo().properties().getProperty("SI_PROMPTS").getValue();
int num_prompts = ((Integer)prompts.getProperty("SI_NUM_PROMPTS").getValue()).intValue();
for(int i=1;i<=num_prompts ;i++)
{
IProperties prompt = (IProperties)prompts.getProperty("SI_PROMPT"+i).getValue();
String promptName = prompt.getProperty("SI_NAME").getValue().toString();
System.out.println("Prompt Name = "+promptName);
IProperties current_values = (IProperties)prompt.getProperty("SI_CURRENT_VALUES").getValue();
int num_values = ((Integer)current_values.getProperty("SI_NUM_VALUES").getValue()).intValue();
for(int j=1;j<=num_values ;j++)
{
System.out.println("num_values:"+num_values);
IProperties value = (IProperties)current_values.getProperty("SI_VALUE"+j).getValue();
if(value.size() == 3)
{
// Range Parameter : contains 3 properties: SI_MIN, SI_MAX, SI_OPTIONS
IProperties minRange = (IProperties)value.getProperty("SI_MIN").getValue();
String min_value = minRange.getProperty("SI_DATA").getValue().toString();
IProperties maxRange = (IProperties)value.getProperty("SI_MAX").getValue();
String max_value = maxRange.getProperty("SI_DATA").getValue().toString();
System.out.println("Range "+j+" Min Value "+min_value+" Max Value "+max_value);
}
else if (value.size() == 4)
{
// Discrete Parameter : contains 4 properties: SI_SHOWDESCONLY, SI_OPTIONS, SI_DESCRIPTION, SI_DATA
String param_value = value.getProperty("SI_DATA").getValue().toString();
System.out.println(" Value "+j+" = "+param_value);
}
}
System.out.println("一个参数的所有参数列表结束");
}
} catch (SDKException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/24167472/viewspace-1038061/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/24167472/viewspace-1038061/