Author Topic: Suggestion on Custom Functions Export  (Read 11980 times)

garysdickinson

  • Hero Member
  • Posts: 502
  • Old PLC Coder
    • View Profile
Suggestion on Custom Functions Export
« on: February 18, 2013, 09:07:17 PM »
I noticed that the "Export" option for the Print Control Panel for Custom Functions generates a file that is output in a strange format.

The lines that form the body of the custom functions are terminated with a single character, Line Feed.  This is "UNIX-like".

The lines that form the headers that separate the custom functions are terminated with the two character pair Carriage Return + Line Feed.  This is "DOS-like".

It would be nicer if the output was consistent in terms of the line terminating.  I would suggest that you use the "DOS-like" pattern of Carriage Return+Linefeed, if I had a vote.

It would be nice if the code also substituted ASCII spaces for the imbedded tabs.

Interestingly, if you use the export option for #DefineTable I see that the lines are consistently terminated with CR + LF and the 3 values are separated with tabs.  This output format is much more predictable (DOS) and imports easily into EXCEL, WORD and simple text editors without problem.

Thanks,

Gary D.

« Last Edit: February 18, 2013, 09:42:10 PM by garysdickinson »

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:Suggestion on Custom Functions Export
« Reply #1 on: February 19, 2013, 04:34:18 PM »
Thank you for your suggestions. Internally each custom function line is separated only by a single newline character  '\n'. When you export a custom function, the i-TRiLOGI program first generates the headings using the java println command, which is to print the heading followed by a linefeed. Since the O/S in this case is Windows, the interaction between the JRE and Windows is such that Windows would  append  a CR+LF at the end of the text.

However, when iTRiLOGI send the text of entire custom function (with all their single LF embedded) to Windows using a println function. Windows would not convert those '\n' embedded within the text to CR+LF but would simply leave them as LF only. This explains why there are two format.

Anyway, the exported custom function .txt files when opened by MS Word does display the newline nicely. So it is not a big issue for those who wants to format their printout the way the like it using the Word editor.
« Last Edit: February 19, 2013, 05:04:31 PM by support »
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

garysdickinson

  • Hero Member
  • Posts: 502
  • Old PLC Coder
    • View Profile
Re:Suggestion on Custom Functions Export
« Reply #2 on: February 19, 2013, 06:14:47 PM »
The issue with the WORD editor is that it does not display TAB stops based on a number of characters such as 4 or 8.

In WORD the tab stops are based on a distances from the left margin on the document.

The closest you can get in WORD is to try and create a template that uses rules based on the units of "points".  Reformat the entire document in a fixed character size of 10 points and then set up tabs on multiple of 10 point increments.

However, the existing tabs in the document don't automatically align to the new tab stops.

In a word, WORD is not a suitable editor for this type of document.

I still think that it would be nice if the exported document had a consistent format.  Since we are working with an ASCII text file, something as dumb as NOTEPAD should be able to open the file.

I have found a free shareware editor named Notepad++ that can convert the file to UNIX format and then convert it back to DOS (Windows) format.  This gets the end of line character(s) consistent.

Thanks for listening,

Gary D.
« Last Edit: February 19, 2013, 11:48:02 PM by garysdickinson »