Don't export a Dataitem in a Dataport

marcoldemarcolde Member Posts: 12
Hi,

i've create a dataport with four dataitems. one dataitem i only you use to create a total for the next dataitem. so this dataitem do not have any dataportfields, but when i use the export it creates a empty line. how can i change the settings that i don't have the empty line.

thanks

Comments

  • fverkelfverkel Member Posts: 66
    Set property DataItemSeparator of the dataport to <None>.
    Just type these 6 characters so it spells <None>.

    If you still want the other data-items to generate a newline, then you could add code for that in OnPreDataItem:
    CurrFile.WRITE('');
    
    Keep It Simple and Stupid (KISS), but never oversimplify.
  • fverkelfverkel Member Posts: 66
    Just remembered ... CurrFile.WRITE('') only generates a newline when TEXTMODE is true.
    Keep It Simple and Stupid (KISS), but never oversimplify.
  • marcoldemarcolde Member Posts: 12
    Hi,

    thank you for your reply, but what means the Textmode is true?

    thanks
    Marco
  • fverkelfverkel Member Posts: 66
    TEXTMODE (from the online help):
    Specifies the mode in which the file will be opened when File.OPEN is called.
    If SetTextmode is true, the file will be opened as an ASCII file. If SetTextmode is false, the file will be opened as a binary file.

    ASCII file (the easiest way)
    Put this in the OnInitDataport:
    CurrFile.TEXTMODE(TRUE);
    

    And in the OnPreDataItem, not in the first data-item and not in the one without output:
    CurrFile.WRITE('');
    CurrFile.WRITE('');
    

    De default value of DataItemSeparator is <NewLine><NewLine>.
    You don't want this in every data-item, so you program it in the ones you need.

    Binary file
    If you would use a binary file (TEXTMODE=false), then you could create the newlines in a different way.
    Define Globals:
    CR Char
    LF Char

    OnPreDataItem:
    CR := 13; LF := 10;
    CurrFile.WRITE(CR); CurrFile.WRITE(LF);
    CurrFile.WRITE(CR); CurrFile.WRITE(LF);
    
    Keep It Simple and Stupid (KISS), but never oversimplify.
Sign In or Register to comment.