# Gateway vs. Client Jython script

**URL:** <https://forum.inductiveautomation.com/t/gateway-vs-client-jython-script/6268>\
**Category:** Ignition\
**Created:** [April 18, 2013, 10:20pm UTC](https://forum.inductiveautomation.com/t/gateway-vs-client-jython-script/6268 "2013-04-18T22:20:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fejowayne8701](https://avatars.discourse-cdn.com/v4/letter/f/e8c25b/32.png) [@fejowayne8701](https://forum.inductiveautomation.com/u/fejowayne8701)\
**Post date:** [April 18, 2013, 10:20pm UTC](https://forum.inductiveautomation.com/t/gateway-vs-client-jython-script/6268/1 "2013-04-18T22:20:53Z")

</div>

When I run the below code in the client as opposed to the designer I get different results:

[code]startDate = 2013-04-18 15:43:38  
endDate = 2013-04-18 21:57:23  
extractInterval = 1  
fileConct = “d:\data\extract\”  
esServer = server1

scanClassQ = “”"  
SELECT sqlth\_scinfo.id, sqlth\_scinfo.scname AS Scan\_Class, sqlth\_te.id As tagID, sqlth\_te.tagpath AS ioTags  
FROM sqlth\_scinfo  
LEFT JOIN sqlth\_te ON sqlth\_scinfo.id = sqlth\_te.scid  
WHERE sqlth\_te.tagpath is not null  
AND sqlth\_scinfo.scname like ‘%s%%’  
“”" %(esServer)   
try:  
#obtain energy Server Scan class   
scTags = system.db.runQuery(scanClassQ)  
#build dictionary list   
scanTagDict[esServer] = [row[‘ioTags’] for row in scTags]   
tags = [row for row in scanTagDict[esServer]]  
print tags  
tagData = system.tag.queryTagHistory(tags, startDate, endDate, None, “MinMax”, “Wide”, tags, None, extractInterval, None, None)  
exportHist = system.dataset.toCSV(tagData, 1, 0)  
system.file.writeFile(fileConct, exportHist , 1)[/code]

Running the code on the client actually returns a dtaset with times, values, and my actually header of all my tags. When running this script as a Timer task on the gateway It only returns the first tag in the sequence and dates with no data points. I’ve attached two sample csv files of the export. Please advise if I’m misinterpreting how the gateway handles lists as opposed to the client.  
[gateway\_2013\_04\_18.csv](https://us1.discourse-cdn.com/inductiveautomation/original/2X/8/854317f965495a23124b898761feec679f238844.csv) (50.3 KB)  
[client\_2013\_04\_18.csv](https://us1.discourse-cdn.com/inductiveautomation/original/2X/f/f62e7dec2de0ffe654d3258c5f15567171285ed7.csv) (1.17 MB)

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [May 20, 2013, 9:17pm UTC](https://forum.inductiveautomation.com/t/gateway-vs-client-jython-script/6268/2 "2013-05-20T21:17:16Z")

</div>

I can’t tell if you forgot to quote your parameter initializations or if we’re missing what the definition of ‘server1’ is. Either way, things should work the same from both the client and the gateway. It will be hard for us to troubleshoot this as is. Perhaps you could put some print statements in your script to help determine what precisely is different in the client vs the gateway?
