data from virtual channels


gse

Recommended Posts

We are a group of materials engineering students attempting to use DAQFactory. We have minimal programming experience, so please bear with us.

We are using a virtual channel to record data from load cell controlled channel after a certain occurence happens to a resistivity sensor. The programming so far, has worked successfully, but we are now trying to export this data into Excel files for further analysis. We are able to get the data out and read in Excel, but it is in one continous stream of data from all of the tests we have done so far.

Our questios are:

1. Clear the history in the virtual and real channels using a sequence.

2. How to set up a clear history button on one of the pages for a virtual and real channel.

3. How to export to a new file everytime you do clear history.

Thank You.

Team GSE

Link to comment
Share on other sites

I'm going to assume you are running under DAQFactory Release 5. If not, please go to www.azeotech.com and download the new release. I think you will find things a bit easier. Assuming you do this:

1) To clear the history, use the ClearHistory() function of the channel. So if you have a V channel called MyChannel:

V.MyChannel.ClearHistory()

2) To clear the history from a button, assign it the Quick Sequence action then put the above code in to clear the history.

3) To export to a new file everytime you clear the history: assuming you've created an export set to export your data, and that exports set's called MyExport, you can change the same of the file using a variable value component directly by using the Set To action and using the Export.MyExport.FileName as the set channel. Alternatively, if you want to prompt the user using a standard window's file save dialog, do this:

a) create a button (or optionally another component that has Actions)

B) set the action to quick sequence

c) set the action code to:

Private.strName = File.FileSaveDialog(Export.MyExport.FileName)
if (!IsEmpty(Private.strName))
    Export.MyExport.FileName = Private.strName
endif

The first line prompts the user and puts the result in a variable. The second line checks to make sure the user didn't press Cancel, and if they didn't, sets the export file name to requested file.

You could then start the export right after that:

Private.strName = File.FileSaveDialog(Export.MyExport.FileName)
if (!IsEmpty(Private.strName))
   Export.MyExport.FileName = Private.strName
   V.MyChannel.ClearHistory()
   beginexport(MyExport)
endif

By putting everything inside the if !IsEmpty() if the user hits cancel nothing happens.

Hopefully this helps. Please feel free to email us with your .ctl document at support@azeotech.com if you have further questions or need help.

Link to comment
Share on other sites

Archived

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