Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Problem with a loop
flosmi
<p>Hi,</p><p> </p><p>my statement looks like:</p><p> </p><p>select distinct tl.starttime, tm.id, tl.verdict, t.module_process_2, t.testlevel, t.patientsafety<br />
from tmconfiguredtestcase tm, tmtestlog tl, parent_child_links pc, tmiteration ti, tmtestcase t<br />
where tm.dbid = TL.CONFIGUREDTESTCASE<br />
and tm.dbid = pc.parent_dbid<br />
and ti.dbid = PC.CHILD_DBID<br />
and tm.testcase = t.dbid<br />
and tl.latest = 'true'<br />
script part:</p><p>this.queryText = this.queryText + "and ("<br />
var parmcount = params["Iteration"].value.length<br />
for( var i=0; i < parmcount; i++ ){<br />
var clause = params["Iteration"].value
;<br />
if (i == 0) {<br />
this.queryText = this.queryText + "(ti.dbid = (select dbid from tmiteration where name = '" + clause + "') and" + "tl.iteration = (select dbid from tmiteration where name = '" + clause + "'))";<br />
}<br />
else {<br />
this.queryText = this.queryText + " or (ti.dbid = (select dbid from tmiteration where name = '" + clause + "') and" + "tl.iteration = (select dbid from tmiteration where name = '" + clause + "'))";<br />
}<br />
} <br />
this.queryText = this.queryText + ")";</p><p> </p><p>the statement works but when i try to run the report i always get an error....</p><p> </p><p>any idea?</p><p> </p><p>thx</p>
Find more posts tagged with
Comments
pricher
<p>Hi,</p><p> </p><p>Looking very quickly at your script, you may be missing a space before the "and" in the following line:</p><p> </p><p>this.queryText = this.queryText + "and ("</p><p> </p><p>P.</p>
flosmi
<p>Hi,</p><p> </p><p>oh there is a space:</p><p> </p><p>this.queryText = this.queryText + "and ("</p><p> </p><p>my first idea was that there is something worng with my loop? its the first time i try such a construct...</p>
micajblock
<p>what is the error?</p>
flosmi
<p>error:</p><p>missing right parenthesis</p><p> </p><p> </p><p>but the statement works in the sql editor... maybe there is something wrong with the loop?</p>
flosmi
<p>any idea why i always get this error?</p><p> </p><p>thx</p>
GLO_FR
<p>Hi,</p><p> </p><p>launch the designer with the eclipsec.exe (=the console)</p><p>Just put an <strong>Packages.java.lang.System.out.println (this.queryText)</strong> at the end.</p><p>Get the generated query and test it in a SQL client or paste it here.</p>
GLO_FR
<p>Are there also spaces here</p><p><strong>and[color=#ff0000;]" + "[/color]tl.iteration</strong></p>