The code doesn't actually replace anything since you assign the result of the replacement to a new variable (querytext
instead of queryText
).
Having trouble replacing /**comment**/ with something else in my javascript and sql
-
20-07-2023 - |
Frage
I'm trying to replace a comment in my sql query using a javascript. My sql query goes something like this.
select round(sum(case when date_part('month', fd.fs_dt) = 1 and date_part('year', fd.fs_dt) = /**year**/ then amount end)::numeric, 0) January_data
from this_table
My javascript query goes something like this.
if (params["This_year"] == "1/1/14"){
this.querytext = this.queryText.replace("/**year**/", "2014")}
else if (params["This_year"] == "1/1/15"){
this.querytext = this.queryText.replace("/**year**/", "2015")}
It's giving me an error at or near 'then'
Lösung
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow