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)
Query Editor
sairag
I have a doubt the way Query Editor works. It seems we cannot able to call multiple queries through the script.
Please find the attached rptdesign.
I tried the folowing cases:
====in script 'beforeOpen'======
qt = "select * from RPT_ASSET_REQUEST_36";
qt1 = "select * from RPT_ASSET_REQUEST_36 ";
this.queryText = this.queryText.replace("scriptSelect",qt).replace("scriptSelect",qt);
this.queryText = this.queryText.replace("scriptSelect1",qt1).replace("scriptSelect1",qt1);
=====in dataset Sql Query editor I used the following===========
Case 1: scriptSelect --> Working
Case 2: scriptSelect UNION ALL scriptSelect --> Working
Case 3: scriptSelect UNION ALL scriptSelect1 --> Not Working
Please correct me if I am wrong.
Thanks
AR
Find more posts tagged with
Comments
Hans_vd
Hi Sairag,
Aren't in the first replace both "scriptSelect" and "scriptSelect1" replaced by qt?
What happens if you use "scriptSelect1" and "scriptSelect2" as placeholders?
Regards
Hans
sairag
<span style='font-size: 12px;'><span style='font-family: Trebuchet MS'><span style='font-family: Arial'><br />
<br />
Hi Hans - Thanks for the response. For your questions plz find my response as below.<br />
<br />
--Aren't in the first replace both "scriptSelect" and "scriptSelect1" replaced by qt?<br />
<br />
>>I tried with <br />
Case 4 :this.queryText = this.queryText.replace("scriptSelect1",qt).replace("scriptSelect1",qt);<br />
It throws the error : table or view does not exist<br />
<br />
--What happens if you use "scriptSelect1" and "scriptSelect2" as placeholders?</span></span></span><br />
>><br />
this.queryText = this.queryText.replace("scriptSelect1",qt).replace("scriptSelect1",qt);<br />
this.queryText = this.queryText.replace("scriptSelect2",qt).replace("scriptSelect2",qt);<br />
<br />
This is working for <br />
<br />
qt = "select * from RPT_ASSET_REQUEST_36";<br />
qt1 = "select * from RPT_ASSET_REQUEST_36 ";<br />
<br />
But throwing the error "table doesn't exist " when I tried the below:<br />
<br />
qt = "select * from RPT_ASSET_REQUEST_36";<br />
qt1 = "select * from RPT_ASSET_REQUEST_PROPERTY_36 ";<br />
<br />
this.queryText = this.queryText.replace("scriptSelect1",qt).replace("scriptSelect1",qt);<br />
this.queryText = this.queryText.replace("scriptSelect2",qt).replace("scriptSelect2",qt);<br />
<br />
Can you please help me understand why it is working for scriptSelect1 & scriptSelect2 ? And not working for scriptSelect & scriptSelect1. <br />
<br />
Thanks
Hans_vd
<blockquote class='ipsBlockquote' ><p>Can you please help me understand why it is working for scriptSelect1 & scriptSelect2 ? And not working for scriptSelect & scriptSelect1.</p></blockquote>
Okay, let's say your data set query is this:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>scriptSelect
union all
scriptSelect1</pre>
and you replace scriptSelect by "SELECT * FROM TABLE"<br />
then your dat set query will look like this:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>SELECT * FROM TABLE
union all
SELECT * FROM TABLE1</pre>
You see? the string "scriptSelect" is replaced two times because in "scriptSelect1" there is also the string "scriptSelect". The "1" is still there. If after that you try to replace "scriptSelect1" by whatever, it will not be found, because it already is replaced in the first call to the replace fuction.<br />
<br />
Regards<br />
Hans
sairag
Hello Hans - Thanks for the explanation.
It really helps. Hans, can you please look into the rptdesign I am attaching here. In the dataset 'Requirement' , I have defined a script in beforeOpen. From the script only else part is working, and if part I am not able to execute. I am trying to figure out the issue with failure attempts.
Can you please help me .
Thanks