Hi,
I have probleme with my SQL statement when i pass a dynamic query face this probleme but when i execute a static query everything is allright.
this is the code in java and the query:
final String SELECT_PCAPT_GRMT="select distinct(pcapt) from te_awba_awch;";
String req="Select Date,PCAPT,lib_pcpt,Remettant,\n" +
"REM_CPT_1,REF_RMT,concat('018-',lpad(sqca,9,0)) Endos,\n" +
"NSER,nser_rem,RIB24,MNT,MNT_REM,\n" +
"(case ano\n" +
"when 'A001&%A010&%A011&%A012&%A014&%A019&%A027&%A032&%A047&%A048&%A050&%A051&%A099&%A52&%A99||0&%0&%0&%0&%0&%0&%0&%0&%0&%0&%0&%0&%0&%0&%0||1&%1&%1&%1&%1&%1&%1&%1&%1&%1&%1&%1&%1&%1&%1'\r\n" +
"then 'Aucun'\n" +
"else 'En cours'\n" +
"end) anom\n" +
"From\n" +
"te_awba_awch\n" +
"Where\n" +
"OPE_ETA <> 'D'\n" +
"PCAPT=$PCAPTS\n" +
"Order by nser_rem";
int result=0;
try {
con_te_ch =ncr.util.DB.getConnection(url,login,pwd,driver);
pcapts=ncr.util.DB.executeQuery(con_te_ch,SELECT_PCAPT_GRMT);
if (pcapts.size()!=0)
{
String rep_out="F:\\Impayes\\AWB\\CHQ\\OUT";
dir_out=new File(rep_out+java.io.File.separator+"20052019");
if (dir_out.exists())
{
;
}
else
{
dir_out.mkdir();
}
}
for (int i=0;i<pcapts.size();++i)
{
pcapt=(java.lang.Object[])pcapts.get(i);
id_pcapt=""+pcapt[0];
user_ctx=null;
user_ctx=new java.util.Hashtable();
user_ctx.put("NAME","PCAPTS");
user_ctx.put("TYPE","A");
user_ctx.put("VALUE",id_pcapt);
user_ctx.put("REGEX","");
user_ctx.put("FORMAT","");
ctx.add(user_ctx);
select_chq=ncr.util.UserCTX.getInstance().eval(req,ctx);
pdf_out=dir_out+java.io.File.separator+ncr.util.Utilitaire.padRight(id_pcapt,5)+"_ETAT_CHQ_GRMT"+".pdf";
params=null;
params=new java.util.HashMap();
params.put("DS",select_chq);
//Edition des CRP
result=extract.pdf.PDF.JRXML2PDF(file_modele_chq,params,con_te_ch,pdf_out);
1 Answer:
And what is "this problem" now that you mentioned??? (Just your snipped doesn't tell what's going wrong --- is there an exception, are there no results, no pages, wrong data,...!?!?
Probably you will struggle with the Parameter syntax ... not sure what this should do:
PCAPT=$PCAPTS
should this be a JasperParameter what would actually $P{PCAPTS} !?!? Where is the AND? Is this an SubSelect? What makes:
ncr.util.UserCTX.getInstance().eval(req,ctx)
??? so please more details or I guess nobody could help you
regards
C-Box