Hourly and Monthly Reports

Carl,

The main issue is, I don’t have access to the data to test the report unless I am on the customer’s machine, or unless I take a 7 hour trip to copy the Ignition project and the full database, which rules out working on this locally. There is no Internet access at the customer’s site, which rules out GoToMeeting. I’m going to poke around on this some more tomorrow. Can someone at least point me to some resources on how lists/arrays/whatever the correct terminology is works in the scripting? Thanks.

[quote=“jgreenewv”]–bump again–

if event.propertyName == "data":
   oldData = system.dataset.toPyDataSet(event.source.data)
   newHeader = ["Hour", "total"]
   newData = []
   midnightValue = oldData[0][1]
   for row in oldData:
      newData.append([row[0],row[1]-midnightValue])
   event.source.data = system.dataset.toDataSet(newHeader, newData)

I’ve determined that this only works as-is on one data column. Can anyone suggest any modifications to get this to work on multiple columns? Thanks.[/quote]
This will work for multiple columns, you just have to add each one. if event.propertyName == "data": oldData = system.dataset.toPyDataSet(event.source.data) newHeader = ["Hour", "total A", "total B", etc...] newData = [] for row in oldData: newData.append([row[0], row[1]-oldData[0][1], row[2]-oldData[0][2], etc...]) event.source.data = system.dataset.toDataSet(newHeader, newData) But I think you are looking for something a little different. Since you want this set:Time Flow A Flow B 00:00:00 0 0 01:00:00 50 10 02:00:00 75 0I think you want to subtract whatever the previous total was. ie if event.propertyName == "data": oldData = system.dataset.toPyDataSet(event.source.data) newHeader = ["Time", "Flow A", "Flow B", etc...] newData = [] #loop through the rows with a counter for i in range(len(oldData)): #make sure the first row doesn't throw an error if i == 0: newData.append([oldData[i][0], 0, 0, etc...) else: newData.append([oldData[i][0], oldData[i][1]-oldData[i-1][1], oldData[i][1]-oldData[i-1][1], etc...]) event.source.data = system.dataset.toDataSet(newHeader, newData)

[quote=“jgreenewv”]Carl,

The main issue is, I don’t have access to the data to test the report unless I am on the customer’s machine, or unless I take a 7 hour trip to copy the Ignition project and the full database, which rules out working on this locally. There is no Internet access at the customer’s site, which rules out GoToMeeting. I’m going to poke around on this some more tomorrow. Can someone at least point me to some resources on how lists/arrays/whatever the correct terminology is works in the scripting? Thanks.[/quote]Yeah, I gathered that, which is why I thought it would be extremely helpful for you to pull a backup of the database and bring it back to the office so that you can work on it locally. Trying to figure out a complex querying/reporting scheme without access to the data is going to be frustrating, to say the least. At least mock up the database structure locally and insert some dummy values…

As far as basic understanding of scripting resources, try the Python Tutorial from our user manual first.

[quote=“jgreenewv”]Carl,

The main issue is, I don’t have access to the data to test the report unless I am on the customer’s machine, or unless I take a 7 hour trip to copy the Ignition project and the full database, which rules out working on this locally. There is no Internet access at the customer’s site, which rules out GoToMeeting. [/quote]

I don’t know if you mean there is not internet on that particular PC, or if the customer is out on a mountain in the middle of nowhere or something, but it might be worth checking into buying a VirginMobile wireless card and getting a one month subscription for forty bucks and mailing it to them. If they have Sprint service available, you can get everything you need off the PC. I do this all the time on PCs that aren’t allowed on the customer network.

Carl/Robert,

Thanks for all the help/suggestions. I got a (probably unelegant) solution working using code similar to Robert’s last example. The biggest problem I was having was working with the multiple columns in the dataset. The Python tutorial Carl linked to didn’t have a good explanation of dealing with the multiple columns, unless I just completely missed it, which is possible.

Step7,

The site this PC is at does not have Internet access. Believe it or not, the person that would approve the purchase of a wireless adapter to be able to get into the system remotely would rather pay me to drive seven hours, download the files or work on the system on site, then drive seven hours back. It’s apparently too much trouble to set up a new wireless account. :unamused:

Either way, it looks like this is working properly now, and I appreciate everyones patience and assistance.

Joe