BOB: Business Objects Board
Not endorsed by or affiliated with SAP

Register | Login 

Follow BOB on Twitter! 
Follow BOB on Twitter! (Opens a new window)  

General Notice: No events within the next 45 days.

bi 4.2 sdk setprompts() does not work for prompt multi


 
Search this topic... | Search SDK (VBA/ASP/JSP)... | Search Box
Register or Login to Post    Forum Index -> SDK (VBA/ASP/JSP)  Previous TopicPrint TopicNext Topic
Author Message
mamentague
Forum Member
Forum Member



Joined: 16 May 2017

Posts: 1



PostPosted: Thu Apr 12, 2018 8:48 am 
Post subject: bi 4.2 sdk setprompts() does not work for prompt multi

Hi everybody,

I try to execute an sdk java program that I migrated from XI3 to BI4.2 SP3

but it does not run correctly.

the program schedule webi reports with prompts that are indicated in an xml properties file.
the schedule run correctly but when a document contains prompts with multi values, the setPrompts() function does not insert the values of the prompts.

if someone has already incounter this problem, please give me an idea to correct my code.
this is a snippet :

import com.businessobjects.rebean.wi.*;
import com.businessobjects.sdk.plugin.desktop.webi.IWebi;
import com.crystaldecisions.sdk.exception.SDKException;
import com.crystaldecisions.sdk.framework.IEnterpriseSession;
import com.crystaldecisions.sdk.occa.infostore.IInfoObject;
import com.crystaldecisions.sdk.occa.infostore.IInfoObjects;
import com.crystaldecisions.sdk.occa.infostore.IInfoStore;
import com.crystaldecisions.sdk.occa.infostore.ISchedulingInfo;
import com.crystaldecisions.sdk.plugin.desktop.program.IProgramBase;

-----
System.out.println("================= INITIALISATION =================");
System.out.println((new StringBuilder("=== ")).append(path).append(NomDoc[0]).toString());
for (int i = 0; i < NomDoc.length; i++) {
final IInfoObjects objs = oInfoStore.query((new StringBuilder("Select * From CI_INFOOBJECTS Where SI_KIND in ('Webi','FullClient') And SI_INSTANCE=0 And SI_NAME = '"))
.append(NomDoc[i].replaceAll("'", "''")).append("' and SI_PARENT_CUID ='").append(last_id).append("'").toString());
System.out.println((new StringBuilder("Select * From CI_INFOOBJECTS Where SI_KIND in ('Webi','FullClient') And SI_INSTANCE=0 And SI_NAME = '"))
.append(NomDoc[i].replaceAll("'", "''")).append("' and SI_PARENT_CUID ='").append(last_id).append("'").toString());
for (int compteur_doc = 0; compteur_doc < objs.size(); compteur_doc++) {
final IInfoObject obj = (IInfoObject) objs.get(compteur_doc);
final String chemin = GetParentArbo.getParentfolderPath(oInfoStore, obj.getCUID());
GetParentArbo.path = "";
for (int a = 0; a < bloc.length; a++) {
System.out.println("");
System.out.println("================= TRAITEMENT =================");
bloc[a] = bloc[a].replace("@rmaeq", rmaeq).replace("@rmaem", Date.getLastMonthLastDate("dd/MM/yyyy")).replace("@DernierJourOuvreDuMois", DernierJourOuvreDuMois)
.replace("@num_mois_prec", num_mois_prec).replace("@num_annee_prec", num_annee_prec).replace("@num_annee", num_annee).replace("@end_month(2)", end_month2)
.replace("@begin_month(2)", begin_month2);
System.out.println((new StringBuilder("Planification avec les valeurs '")).append(bloc[a]).append("'").toString());
//p_parameters = bloc[a].split("\244");
p_parameters = bloc[a].split(";");
final IWebi webi = (IWebi) objs.get(compteur_doc);
final DocumentInstance documentInstance = reportEngine.openDocument(webi.getID());

documentInstance.refresh();

/*try{
documentInstance.getDataProviders().runQueries();
}catch(Exception e){
System.out.println(e);
}*/

final Prompts prompts = documentInstance.getPrompts();
System.out.println((new StringBuilder("Nombre d'invites : ")).append(prompts.getCount()).toString());
if (p_parameters[0].equals("")) {
titre = INSTANCE_TITLE;
} else if (prompts.getCount() != p_parameters.length) {
throw new Exception("le nombre d'invites ne correspond pas avec celui attendu");
}
titre = INSTANCE_TITLE;

System.out.println("----PROCESSING----");
for (int j = 0; j < prompts.getCount(); j++) {
final Prompt prompt = prompts.getItem(j);
final String p_parameter = p_parameters[j].trim();
if(!p_parameter.equals("")){
if (prompt.getType() == PromptType.Mono) {
if(prompt.hasLOV() ){
String curPromptVal = p_parameters[j];
ValueFromLov[] set = new ValueFromLov[1];
Lov lov = prompt.getLOV();
Values vals=lov.getAllValues();
set[0]=null;
for(int lovI=0;lovI<vals.getCount();lovI++){
if(vals.getValue(lovI).equals(curPromptVal)){
set[0] = vals.getValueFromLov(lovI);break;
}
}
System.out.println("Mono - Inside prompt has LOV >> set >> "+p_parameter);
titre = titre.replace(prompt.getName(), p_parameter);
if(!(set.equals(null) & prompt.isOptional()))
prompt.enterValues(p_parameter.split(","));
else
prompt.enterValues(set);
}else{
final String vals[] = new String[1];
vals[0] = p_parameters[j];
System.out.println("Mono - no Lov >> set >> "+vals[0]);
titre = titre.replace(prompt.getName(), vals[0]);
prompt.enterValues(vals);
}
} else {
if(prompt.hasLOV() ){
String[] curPromptVals = p_parameter.split(",");
ValueFromLov[] set = new ValueFromLov[curPromptVals.length];
Lov lov = prompt.getLOV();
Values vals=lov.getAllValues();
int index=0;
for (String curPromptVal : curPromptVals){
for(int lovI=0;lovI<vals.getCount();lovI++){
if(vals.getValue(lovI).equals(curPromptVal)){
set[index] = vals.getValueFromLov(lovI);
break;
}
}
index++;
}
System.out.println("Multi - Inside prompt has LOV >> set >> "+set[index-1].getValue().toString());
titre = titre.replace(prompt.getName(), set[index-1].getValue().toString());
prompt.enterValues(set);
}else{

int iPosBegin = 0;
int iPosEnd = 0;
int iNbValue = 0;
final String lsParam = p_parameters[j];
while (iPosEnd != -1) {
iPosEnd = lsParam.indexOf(";", iPosBegin);
iPosBegin = iPosEnd + 1;
iNbValue++;
}
final String vals[] = new String[iNbValue];
iPosBegin = 0;
iPosEnd = 0;
iNbValue = 0;
final Calendar cal = Calendar.getInstance();
final int month = cal.get(2) + 1;
while (iPosEnd != -1) {
iPosEnd = lsParam.indexOf(";", iPosBegin);
iNbValue++;
if (iPosEnd == -1) {
vals[iNbValue - 1] = lsParam.substring(iPosBegin, lsParam.length());
} else {
vals[iNbValue - 1] = lsParam.substring(iPosBegin, iPosEnd);
}
titre = titre.replace(prompt.getName(), vals[iNbValue - 1]);
iPosBegin = iPosEnd + 1;
}
if (!(prompt.isOptional() & vals[iNbValue - 1].replace(" ", "").equals(""))) {
System.out.println("Multi - no Lov >> set >> "+vals[0]);
prompt.enterValues(vals);
}
}
}
}
}

//PromptsUtil.populateWebiPrompts(prompts, webi);
documentInstance.refresh();
//try{
// documentInstance.getDataProviders().runQueries();
//}
//catch(Exception e){System.out.println(e);};
documentInstance.setPrompts();
documentInstance.save();
System.out.println("----AFTER SETPROMPTS----");
for (int j=0; j<prompts.getCount();j++){
final Prompt prompt = prompts.getItem(j);
if (prompt.getType() == PromptType.Mono) {
if(prompt.getCurrentValues().length>0){
System.out.println("Mono -> CurrentValues de "+prompt.getName()+" "+prompt.getCurrentValues()[0].toString());
}
if(prompt.getPreviousValues().length>0){
System.out.println("Mono -> PreviousValues de "+prompt.getName()+" "+prompt.getPreviousValues()[0].toString());
}
if(prompt.getDefaultValues().length>0){
System.out.println("Mono -> DefaultValues de "+prompt.getName()+" "+prompt.getDefaultValues()[0].toString());
}
}else{
if(prompt.getCurrentValues().length>0){
System.out.println("Multi -> CurrentValues de "+prompt.getName()+" "+prompt.getCurrentValues()[0].toString());
}
if(prompt.getPreviousValues().length>0){
System.out.println("Multi -> PreviousValues de "+prompt.getName()+" "+prompt.getPreviousValues()[0].toString());
}
if(prompt.getDefaultValues().length>0){
System.out.println("Multi -> DefaultValues de "+prompt.getName()+" "+prompt.getDefaultValues()[0].toString());
}

}
}

THANKS A LOT
Back to top
hilfy
Forum Enthusiast
Forum Enthusiast



Joined: 16 Apr 2007
ASUG Icon
speaker.gif*3
Posts: 1846
Location: Atlanta, GA


flag
PostPosted: Wed May 09, 2018 11:03 am 
Post subject: Re: bi 4.2 sdk setprompts() does not work for prompt multi

A lot of stuff around Webi reports has been deprecated from the Java SDK. Instead, you'll use the RESTful Web Services SDK to set the parameters and create the schedule.

In versions earlier thatn 4.2 SP5, the RESTful Web Services SDK runs on the Web Application Container Server. Starting with 4.2 SP5, there is an option to deploy it to the web server (Tomcat, etc.). The beauty of this SDK is that you don't have to download any libraries that compile into your code. Instead, you communicate with the web service via HTTP GET and HTTP POST commands and the response from the server will be in either XML or JSON format (depending on what you select.) This is the direction that SAP is headed in for ALL of the SDKs, so it would be good to learn it sooner rather than later.

-Dell

_________________
Protiviti
Data & Analytics Practice
https://www.protiviti.com/US-en/data-management-advanced-analytics
Back to top
mgr74
Forum Member
Forum Member



Joined: 16 Jul 2018

Posts: 1



PostPosted: Mon Jul 16, 2018 4:35 pm 
Post subject: Re: bi 4.2 sdk setprompts() does not work for prompt multi

Did you get this working. I have code which I need to migrate from 3.1 to 4.2 BO SDK. Any sample working code in 4.2 will help.
Thanks
Back to top
Display posts from previous:   
Register or Login to Post    Forum Index -> SDK (VBA/ASP/JSP)  Previous TopicPrint TopicNext Topic
Page 1 of 1 All times are GMT - 5 Hours
 
Jump to:  

Index | About | FAQ | RAG | Privacy | Search |  Register |  Login 

Get community updates via Twitter:

Not endorsed by or affiliated with SAP
Powered by phpBB © phpBB Group
Generated in 0.0334 seconds using 17 queries. (SQL 0.0033 Parse 0.0009 Other 0.0292)
CCBot/2.0 (https://commoncrawl.org/faq/)
Hosted by ForumTopics.com | Terms of Service
phpBB Customizations by the phpBBDoctor.com
Shameless plug for MomentsOfLight.com Moments of Light Logo