paulneal Posted February 10, 2010 Share Posted February 10, 2010 i have written some script that autoselects traces based on a bit array. However i am trying to autscale with some problems. The "trace1[a]" parameter does not work in the max function. If i just type in ambient then everything is fine. I am assuming i have to remove the "" marks but am not sure. Cheers in advance Paul. global trace_sel global graph_max global graph_min private string trace1 private string trace2 private A global string B trace1[1] = "AMBIENT" trace1[2] = "SHOPFLOOR" trace1[3] = "DX_1" trace1[4] = "DX_2" trace1[5] = "WAT_IN" trace1[6] = "WAT_OUT" trace1[7] = "STORES" trace1[8] = "PROBE_6" trace2[1] = "AMBIENT" trace2[2] = "SHOPFLOOR" trace2[3] = "DIXELL 1" trace2[4] = "DIXELL 2" trace2[5] = "WAT_IN" trace2[6] = "WAT_OUT" trace2[7] = "STORES" trace2[8] = "PROBE_6" if (trace_sel[0]>0) A = trace_sel[0] Component.pplots1.DeleteTrace("LINE_1") Component.pplots1.AddTrace("LINE_1") Component.pplots1.LINE_1.color=1058796 Component.pplots1.LINE_1.strYExpression=TRACE1[a] Component.pplots1.LINE_1.strLabel=trace2[a] Component.pplots1.LINE_1.LineType = 5 B=trace1[a] graph_max=max(b[0,50]) else Component.pplots1.DeleteTrace("LINE_1") endif if (trace_sel[1]>0) A = trace_sel[1] Component.pplots1.DeleteTrace("LINE_2") Component.pplots1.AddTrace("LINE_2") Component.pplots1.LINE_2.color=16588818 Component.pplots1.LINE_2.strYExpression=TRACE1[a] Component.pplots1.LINE_2.strLabel=trace2[a] Component.pplots1.LINE_2.LineType = 5 else Component.pplots1.DeleteTrace("LINE_2") endif Link to comment Share on other sites More sharing options...
AzeoTech Posted February 10, 2010 Share Posted February 10, 2010 you need to use the execute() statement or evaluate() function when you want to do a macro expansion like this (a macro expansion is when you have part or all of the expression contained in a string. Not a DF term, but a general application term). So: graph_max = evaluate("max(" + trace1[a] + "[0,50])") Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.