print of table with longterm data


osmansirmali

Recommended Posts

Hi

I have important problem for printing with longterm table list. I knew normally functions capture of screen or only printscreen... I want to print whole data from longterm table list. (for Suddenly more page...) Colud you please send me urgently your answer for this my problem.

Thank's attentions.

Best regards

Link to comment
Share on other sites

OK, the easiest way to do this is to simply create a file with your report and then trigger printing it. For example, if you had three channels named test, test2 and test3 you would do something like this:

// open file for writing:
private handle = file.Open("c:\printme.txt",0,1,0,1)
// write header:
file.Write(handle, "This is a report!")
//write data
for (private x = 0, x < numrows(test), x++)
   file.Write(handle,format("%s\t%.3f\t%.3f\t%.3f",formatdatetime("%c",test.Time[x]),test[x],test2[x],test3[x]))
endfor
// close
file.Close(handle)
// print file
system.ShellExecute("c:\printme.txt","print")

This assumes that you have the .txt extension associated with notepad (the default). It may work if you have it associated with something else too.

Most of the report formatting is done in that single format() function. The %s means put a string here (in this case the date formatted using the normal date/time format), the %.3f means put a number here with 3 decimals. The \t are tab characters and will put the numbers in nice columns. Note that if you have more than 18 channels, you are going to have to use multiple format() functions as DAQFactory functions accept a max of 20 parameters. You can just concat them using + (i.e. format(...) + format(...)) in groups of 10 or so.

I've attached a sample as well. Let it run for a 30 seconds or so to accumulate a little data, then run the printtable sequence.

reportsimple.ctl

Link to comment
Share on other sites

  • 13 years later...

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.