Andreschrosa Posted February 5, 2009 Share Posted February 5, 2009 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 More sharing options...
AzeoTech Posted February 5, 2009 Share Posted February 5, 2009 I don't think you want sDados[h] in the first execute. h it being iterated across result.TheTime which likely is a different sized array the sDados and I'm sure this is not what you meant to do. Link to comment Share on other sites More sharing options...
Andreschrosa Posted February 6, 2009 Author Share Posted February 6, 2009 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 More sharing options...
AzeoTech Posted February 7, 2009 Share Posted February 7, 2009 You are missing an opening " after AddValue( If that doesn't fix it, try just adding a fixed value: execute(sDados[j] + ".AddValue(3)") Then work up in complexity. This is the best way to debug anything. Link to comment Share on other sites More sharing options...
Andreschrosa Posted February 10, 2009 Author Share Posted February 10, 2009 I found it, the channel is not available for sequences and command until you go to channel list and click apply. How could I go around it, since doing channel.Restart() dosent seen to fix it? Link to comment Share on other sites More sharing options...
Andreschrosa Posted February 10, 2009 Author Share Posted February 10, 2009 My problem was in my sequence, there was some lines where I concatenated then using ", " as a separator, then this string was parsed by ",", which made each variable have a space in front, so the channels where created like " Vm" insteady of "Vm"! Link to comment Share on other sites More sharing options...
AzeoTech Posted February 10, 2009 Share Posted February 10, 2009 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.