# system.tag.queryTagHistory question

**URL:** <https://forum.inductiveautomation.com/t/system-tag-querytaghistory-question/5943>\
**Category:** General Discussion\
**Created:** [February 28, 2013, 9:57pm UTC](https://forum.inductiveautomation.com/t/system-tag-querytaghistory-question/5943 "2013-02-28T21:57:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rcorkern](https://avatars.discourse-cdn.com/v4/letter/r/90db22/32.png) [@rcorkern](https://forum.inductiveautomation.com/u/rcorkern)\
**Post date:** [February 28, 2013, 9:57pm UTC](https://forum.inductiveautomation.com/t/system-tag-querytaghistory-question/5943/1 "2013-02-28T21:57:33Z")

</div>

We have the below script in the event handle of a button:

paths = event.source.parent.selectedLocation  
startDate = event.source.parent.getComponent(‘Date Range’).startDate  
endDate = event.source.parent.getComponent(‘Date Range’).endDate  
query = system.tag.queryTagHistory(paths, startDate, endDate)  
event.source.parent.query = query

which generates following error : Illegal character ‘[’ (Line 1 , Char 1)

When we replace the ‘query = system.tag.queryTagHistory(paths, startDate, endDate)’  
with ’ query = [‘path/to/tag’]’ it runs fine.

am I doing something wrong in the syntax for the ‘query’ not to be dynamic?

Thanks

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [February 28, 2013, 10:01pm UTC](https://forum.inductiveautomation.com/t/system-tag-querytaghistory-question/5943/2 "2013-02-28T22:01:59Z")

</div>

Yes, the paths for the system.tag.queryTagHistory function must be a list. You are probably sending in a string since you are getting it from the selectedLocation property on the screen. You need to make a list out of it. If the selectedLocation property is a string with comma separated values you will need to split it into a list like this:`paths = event.source.parent.selectedLocation.split(",")
startDate = event.source.parent.getComponent('Date Range').startDate
endDate = event.source.parent.getComponent('Date Range').endDate
query = system.tag.queryTagHistory(paths, startDate, endDate)
event.source.parent.query = query`
