Quick channel group history clear?


Recommended Posts

private string clist = channel.listAll("T1")
for (private i = 0, i < numrows(clist), i++)
   execute("ClearHistory" + clist + )
endfor

This throws an error.

C1070 Not enough parameters for the given operator: Discharge Line 3 - Uncaught error in sequence Discharge


I missed something here. Is is because it is a channel group? I need to use a different command parameter?

Link to comment
Share on other sites

When using execute() or evaluate() and things don't go as planned, I recommend adding a ? statement before it so you can see what the string you are building becomes.  In your case, you have to fix a more fundamental error first, the trailing + sign.  Then it would read:

? "ClearHistory" + clist
execute("ClearHistory" + clist)

The next problem is that clist is an array, and you aren't subsetting.  Since string concatenation with + only supports scalars, DAQFactory will ignore the array and just use the first element ([0]).  Well, that isn't what you want.   You need to add after clist to get each channel in the list as you iterate.

Finally, once you fix all the syntax errors:

? "ClearHistory" + clist
execute("ClearHistory" + clist)

You'll see that the string you are building makes no sense.  ClearHistory is a function of individual channels.  So, to clear the history of myChannel you would do:

myChannel.clearHistory()

In your case, if clist has "myChannel", you'd get:

ClearHistoryMyChannel

which will do nothing but probably generate another error.  The ? statement would show you this problem.  So, you need to modify your string build up to create the correct string.  

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.