Joining 2 query tags

Good day all. Can you join 2 query tags? I know I can do it in the named query with a combinedDataset python code, only issue with this is the query take too long to do what I want in a timely manner. So, I have the query into a tag rather than a Named Query.

There's no native way to join (SQL-like I presume) datasets. You need jython. Consider an expression tag that hands off to runScript with the two other tags as arguments.

Thats a good idea. Ill try to put something together and probably (more than likely) ask for input. LOL

So here is how I was doing it previously (cant do it like this anymore due to IT restrictions):

def transform(self, value, quality, timestamp):
		
	styleAccountedFor = {'backgroundColor': "green"}
	MusterCall = value #system.db.runNamedQuery('MusterCall')
	SM_Salary = system.db.runNamedQuery('SM_Salary')
	combinedDataset = system.dataset.appendDataset(MusterCall,SM_Salary)
	combinedData = system.dataset.toPyDataSet(combinedDataset)
	    
	headers = system.dataset.getColumnHeaders(combinedData)
	        
	checkedInData = (self.getSibling("Table_0").props.data)
	accountedBadgeNum = [B['Badge_Num'] for B in checkedInData]
	            
	pyObj = []
	            
	for row in combinedData:
	    pyDict = {}
	    pyValueDict = {headers[i]: row[i] for i in range(len(row))}
	    if pyValueDict['ShawEmployeeID'] in accountedBadgeNum:
	        pyValueDict['isAccountedFor'] = True
	        pyDict['value'] = pyValueDict
	        pyDict["style"] = styleAccountedFor
	    else:
	        pyValueDict['isAccountedFor'] = False
	        pyDict['value'] = pyValueDict
	    pyObj.append(pyDict)
	        
	                    
	return pyObj

Here is how im tring to make an expression tag using the runScript:

runScript("MusterCall = system.db.runNamedQuery('MusterCall') SM_Salary = system.db.runNamedQuery('SM_Salary') combinedDataset = system.dataset.appendDataset(MusterCall,SM_Salary) combinedData = system.dataset.toPyDataSet(combinedDataset)")

Am I remotely close?

No, with runScript, you must choose between a one-line jython expression that returns your value, possibly involving scripts from your gateway scripting module, or a simple function name from your gateway scripting project, with arguments after the polling interval passed to that function.

So, something like this in the expression:

runScript("myScript.myFunction", 0, {[.]SomeTag}, {[.]SomeOtherTag})

That function would do the rest of the work.

SO I have something that works for me:
I have the Name query that took too long as a query tag and appended my other Named Query onto it like this:

	styleAccountedFor = {'backgroundColor': "green"}
	MusterCall = value
	SM_Salary = system.db.runNamedQuery('SM_Salary')
	combinedDataset = system.dataset.appendDataset(MusterCall,SM_Salary)
	combinedData = system.dataset.toPyDataSet(combinedDataset)
		    
	headers = system.dataset.getColumnHeaders(combinedData)
		        
	checkedInData = (self.getSibling("Table_0").props.data)
	accountedBadgeNum = [B['Badge_Num'] for B in checkedInData]
		            
	pyObj = []
		            
	for row in combinedData:
	    pyDict = {}
	    pyValueDict = {headers[i]: row[i] for i in range(len(row))}
	    if pyValueDict['ShawEmployeeID'] in accountedBadgeNum:
	        pyValueDict['isAccountedFor'] = True
	        pyDict['value'] = pyValueDict
	        pyDict["style"] = styleAccountedFor
	    else:
	        pyValueDict['isAccountedFor'] = False
	        pyDict['value'] = pyValueDict
	    pyObj.append(pyDict)
		        
		                    
	return pyObj

whole thing looks like this:

It mostly does what I want to.

My issue now is that the style is being applied very slow, as in lagging way behind. How can I speed that up? The style is applied when LH table sees the same data in RH table:

You could try with a query tag for each query and use an expression structure binding, instead of making one of the query in the transform.

PS: code style is good, but please get rid of all the extra whitespaces, it's triggering my OCD :X
(also, the double quotes on line 22)

edit:
Wait, where is that binding ? Is that on the table ?

For anyone else wanting a solution I came up with a message handler that does the refreshBinding on the LH table when the RH tables data changes (change script). That way when my INSERT INTO python code populates the RH table a message tells the LH table to refresh its binding and and the style get applied.