Filling Channels from MySQL


Recommended Posts

I'm currently selecting from MySQL database and trying to add the results to some channels and then add to the graph.

for(private.j = 1, j < numrows(sDados), j++)

	  for(private.h = 0, h < numrows(result.TheTime), h++)		 

		 Channel.Add(sDados[j], "test", "A/D",0 ,0)
		 Execute(sDados[j] + ".AddValue(Result." + sDados[h] + ")")
		 Execute(sDados[j]+ "[" + h + "]" + ".time = Result.TheTime[" + h + "]")
		 //Component.GraficoGrd.AddTrace(...

	  endfor

endfor

sDados is an array containing the variables selected from sql, example: sDados[1] = Vm_1_0

It only works until the Channel.Add line.

What is wrong with the two Execute lines?

Link to comment
Share on other sites

Somehow the channels are created, but no data is added. Now it wont cause an error anymore on the execute lines. Any thoughts?

for(private.j = 1, j < numrows(sDados), j++)

	  for(private.h = 0, h < numrows(result.TheTime), h++)		 

		 Channel.Add(sDados[j], "test", "A/D",0 ,0)
		 Execute(sDados[j] + ".AddValue(Result." + sDados[j] + "_" + curnet + "_" + device + "[" + h + "])")
		 Execute(sDados[j]+ "[" + h + "]" + ".time = Result.TheTime[" + h + "]")
		 //Component.GraficoGrd.AddTrace(

	  endfor

   endfor

Link to comment
Share on other sites

Glad you got it working. As to the 7:38am post: as it says somewhere in the manual, dynamically adding channels does not cause the workspace to update until you add or modify the channel list from the workspace. It is assumed that if you are doing it dynamically, you are in runtime and don't need to use the workspace. It was also done because updating the workspace is performance issue.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.