Changing Logging File Name


EngineeringEnergy

Recommended Posts

I would like to have a way to name the logging file from the main screen. I was thinking of using an edit box where the desired name can be entered. However, I don't know if it is possible or how to make this this data file name.

I also have a button on the main screen to start and stop logging (the button was the only component that I could easily make start/stop logging) however, I don't like that you can't tell whether or not the button has been pushed. Is there a more appropriate component to use for this or a way to show that logging has been started?

Thanks

Link to comment
Share on other sites

I've attached a sample that shows just one way of handling these two items. The key to the filename part is that logging sets expose a variable called strFileName with the name of the file. You can use this to display or edit the file name of a logging set. The File.FileSaveDialog() provides the standard windows file dialog.

As for starting and stopping, again, there is the Running variable of the logging set which can be used in variety of controls to display the current status. In this sample, I simply used a Descriptive Text component with color and text changes for the two states. Clicking on it will toggle the state.

logFileSample.ctl

Link to comment
Share on other sites

  • 2 months later...

Ahh, that was what I was doing wrong....

I like the button forcing you to make to folder location...

I was just setting the variables name and the location didn't exist causing the error i was having in other posts...

The button in the above ctl file fixed my export naming issue...Thanks AzeoTech... :)

Link to comment
Share on other sites

  • 9 months later...
  • 2 years later...

Hi, I have just opened the sample file posted and I was wondering if there was anyway I could alter the button to make it automatically change the filename every time I start an experiment. So if I press the start logging button it changes the filename. The filenames I am trying to make it log as would be d + year + month + day+_0 + n, where n would be the experiment number on the day. 

 

I am sorry but I am extremely new to DAQ Factory so I don't really know the language used very well at all, any help would be amazing and if anyone could use quite simple language though, like I say I am extremely new to DAQ Factory and can't seem to find any literature for it posted on-line anywhere.

 

Thanks again,

 

Matt

Link to comment
Share on other sites

Doing the experiment # is a little more complicated.  Do you shut down every night, or does DAQFactory need to detect the new day?  For now, here's how to simply put a date/time stamp.  Just replace the entire Action script in the button to:

 

logging.myLog.strFileName = formatDateTime("d%y%m%d_%H%M%S", systime())

 

See 4.12.11 in the user's guide.

Link to comment
Share on other sites

Thank you for that I will include that in the button. No the experiment is not shut off every night, it is just left running but the DAQFactory code does need to detect the new day though and change part of it's name accordingly. Is this possible? Especially as the date is nested in the middle of the name.

 

Thanks for the quick response, and sorry I've been so long in getting round to checking this site I assumed I would receive an email if someone replied, so I was a bit lazy and didn't check. 

Link to comment
Share on other sites

If you don't mind simply using a time stamp and not numbering the experiments during the day, what I sent you will work fine.  If you do want it numbered its a bit trickier, especially if you occasionally restart DAQFactory during the day.  I personally would stick with the date/time stamp.  If you keep it like I have with year, then month, then day, etc, then the files sort very nicely in Explorer.

Link to comment
Share on other sites

Archived

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