mokhtar.sougrati Posted May 21, 2019 Share Posted May 21, 2019 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 anon" + "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'rn" + "then 'Aucun'n" + "else 'En cours'n" + "end) anomn" + "Fromn" + "te_awba_awchn" + "Wheren" + "OPE_ETA <> 'D'n" + "PCAPT=$PCAPTSn" + "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); Link to comment Share on other sites More sharing options...
C-Box Posted May 24, 2019 Share Posted May 24, 2019 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[/code] 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)[/code]??? so please more details or I guess nobody could help youregardsC-Box Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now