Use string concatenation like:
|query('SELECT count(jobRunTime) FROM "metrics"."days30"."tasks" where
"component"=\'site\' and "taskType"= \'' + taskType + '\' and "status" =
\'FINISHED\'')
Your solution would be nicer and maybe we should add it but for now this
works.
On Thursday, November 17, 2016 at 8:52:50 PM UTC-7, [email protected] wrote:
>
> kapacitor 1.1, influx 1.1
>
> I'm trying to create a template. In the template, I'd like to include a
> parameter in the batch query. Here is what i got
>
> var myperiod=60m
> var mytime=60m
> var myevery=60m
>
> var success = batch
> |query('''SELECT count(jobRunTime) FROM "metrics"."days30"."tasks"
> where "component"='site' and "taskType"='Task1' and "status" = 'FINISHED'
> ''')
> .period(myperiod)
> .every(myevery)
> .groupBy(time(mytime), 'id','serverID')
> .align()
> .fill(0)
>
> I want this
>
> var myperiod=60m
> var mytime=60m
> var myevery=60m
> var taskType='Task2'
>
>
> var success = batch
> |query('''SELECT count(jobRunTime) FROM "metrics"."days30"."tasks"
> where "component"='site' and "taskType"=$taskType and "status" = 'FINISHED'
> ''')
> .period(myperiod)
> .every(myevery)
> .groupBy(time(mytime), 'id','serverID')
> .align()
> .fill(0)
>
>
--
Remember to include the version number!
---
You received this message because you are subscribed to the Google Groups
"InfluxData" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/influxdb.
To view this discussion on the web visit
https://groups.google.com/d/msgid/influxdb/0dfb4516-f735-45d0-9ef4-0613d83d5207%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.