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 replace text not working
jfreak53
For some reason when I run this in the onBefore of my query nothing is returned, but when I remove it or comment it out, the query works:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>this.queryText = this.queryText.replace("AND DATE_FORMAT(fecha_partida, '%Y-%m-%d') = '2010-06-23'", "AND DATE_FORMAT(fecha_partida, '%Y-%m-%d') = '" + params["fpoliza"] + "'");</pre>
<br />
I have checked the query code in MySQL many times and that's all good. And this is the exact same way that I have done it in other reports, the exact same way. A text field param with a data format to it and formatting applied in the way of yyyy-mm-dd. This is the same way I have done it before and it works. Not errors either, but this time it's not working with this new report. Any ideas?
Find more posts tagged with
Comments
thuston
do you need params["fpoliza"].value?
is params["fpoliza"] a Date datatype, you will need to format it into a string?
foolcatjr
If you want to change the Data set's SQL script, you need to write the script in Data Set's "beforeOpen" method.
Select the DataSet, then select the "Script" tab, choose "beforeOpen".
jfreak53
Thanks guys, yes I did put it in the beforeOpen part of the script for the dataset in question. I just wrote it wrong here ha ha.
And I have also tried it with .value instead of straight. You see, I have 10 other reports made the EXACT same way and working just fine, without the .value and everything else is the same. So this one isn't working for some reason.
I should state that the dataset is re-opened after since it's called by a dropdown from a cascading param group, like the other reports I've made just like this one.
thuston
That script should only work once.
The second time "AND DATE_FORMAT(fecha_partida, '%Y-%m-%d') = '2010-06-23'" no longer exists.
Don't use this query in a dynamic parameter, if you need a parameter value for it to run as desired.
jfreak53
No, that one I only use once yes. But then I run another replace on the same query for a different term, so that should work for a different term. I don't run for the same term twice.
jfreak53
It was a problem with formatting, we are all good now thanks for the help.