Combine two datasets

sir what i am trying to achieve is , in chart when user selected 2 tags and in chart its showing data from 4 am to 5am for both the tags
but what i am trying is do offset concept. i want to show second tag from 4.10am to 4.50am some offset to second tag

so i am trying to run system.tag.queryTagHistory for every selection of tags in tag tree browser and i am changing start time and end time in query to show some offset between the tags

but i want to show all the tags data in single dataset. because timestamp column will be same

can you help me on this

If you are running a separate query for each one, then you can append each query result to a list, then sent that list to the function

datasetList = []
for tag in tagList:
	datasetList.append(system.tag.queryTagHistory(tag, other_params, as_needed)

combinedData = combineDatasets(datasetList)

'int' object is not iterable still same error for i in selectedPaths.rowCount: - in this line

Sorry, my caffeine must have run out. Time for more coffee…

for i in range(selectedPaths.rowCount):

no problem sir

readonly attribute - getting this error

Better show us what you have so far, and the full error text. The error isn’t making any sense to me at the moment.


error and script i have attached

Wow, I really dropped the ball on that one.

if event.propertyName = 'selectedPaths':
	selectedPaths = event.source.selectedPaths
	tagList = []
	for i in selectedPaths.rowCount:
		tagList.append(selectedPaths.getValueAt(i,0))

Updated my post above.

3 Likes


i used this script merge to dataset values.

but i am getting output like this.

is there any way to correct the issue?

what is the issue exactly?
i notice you 2nd colum says kWhTon while the other one is just kwh, might be better to visualise if they both have the same unit

both are different tags, i merging 2 different tags dataset in to single dataset. keeping timestamp column common for both. when i merge i am getting output like that.

this is what i am trying to do

sir what i am trying to achieve is , in chart when user selected 2 tags and in chart its showing data from 4 am to 5am for both the tags
but what i am trying is do offset concept. i want to show second tag from 4.10am to 4.50am some offset to second tag

so i am trying to run system.tag.queryTagHistory for every selection of tags in tag tree browser and i am changing start time and end time in query to show some offset between the tags

but i want to show all the tags data in single dataset. because timestamp column will be same

im not sure if its smart to offset data on a chart, that is very confusing to know the actual values then.
Is a different color not enough?
Right now the Ton vlaue table just appears as a flat line becuase the values are only 10 while the other table goes to 16000
I suggest you multiply the second collum by a 1000 aswell and call it kwh.

but i have assigned task to do that. so only i am trying hard to find solution

then i guess you multiply by 999 or something. I suggest you do taht in a new dataset so you keep the actualy values unchanged
Its very weird tho. Also what are these numbers? such high values for kwh every second? xD

Ya tired with other tags also. but same issue, some space is showing in chart

What is the result if you multiple second clm by 1000?

no i don’t want to multiple. because its actual tag value i want to show in chart
i am getting the output by running system.tag.queryTagHistory

Yes but one colum has a different unit than the other so you cant show them on the same chart than unless you convert it to match.
i mean you can but then you just get what you ahve now

ya ok please let me know if you any other idea to do offset concept . which i mentioned above. in your free time please think about it