SteveMyres Posted June 20, 2018 Share Posted June 20, 2018 Manually entering MyChannelName.Addvalue(AscA(MyString)) works (it pushes all the ASCII codes in as consecutive channel points), but if I place it in an execute(), it seems to build the script string with only the ASCII value for the first character, rather than AscA(strArg) evaluating to a numeric array (as if I used Asc()) execute(ChannelName + ".Addvalue(" + AscA(strArg) + ")") Evaluate does the same thing -- treats the AscA() as if the string were only one character. Link to comment Share on other sites More sharing options...
AzeoTech Posted June 23, 2018 Share Posted June 23, 2018 Actually the problem isn't with asca(). The problem is that string concatenation doesn't support arrays. So even: ? "array: " + {1,2,3} + " end array" will print: array: 1 end array The problem is that DAQFactory doesn't really know how you want to present the array. Do you want a comma delimited list? With brackets or without? Space after the comma? Etc. Plus, beginners often really only want [0], especially when using channels, but forget to do so. So: "My Value: " + myChannel will do the same as: "My Value: " + myChannel[0] So, in your case, what you really need to do is keep the asca() in the quotes: execute(ChannelName + ".AddValue(asca(" + strArg + "))") that way the concatenation doesn't involve the array. But then, why are you pulling out strArg anyway? Remember, execute() runs in the scope of the call script, so you should be able to reference strArg from within the string: execute(ChannelName = ".AddValue(asca(strArg))") Link to comment Share on other sites More sharing options...
SteveMyres Posted June 25, 2018 Author Share Posted June 25, 2018 Oh! Duh, don't know why I was doing that. Just in the habit of evaluating everything down to a final answer before concatenating (primarily for the creation of display strings and so on). Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.