Announcement

Collapse
No announcement yet.

Field

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Michael Mattias
    replied
    but the number of fields is unknown at compile time, so I was looking at how I could use an array and fill the columns with data
    Code:
      LOCAL  col() AS FIELD 
    
      ....
      REDIM  col(nField-1) 
      FOR Z =  LBOUND(Col,1) TO UBOUND (col,1) 
          FIELD  OutputLine$,  FROM xxxx    TO YYY AS Col(Z)   <<< MATH NEEDED HERE 
      NEXT
    Using the FROM..TO option you can FIELD part of the buffer each loop.

    Leave a comment:


  • Richard Angell
    replied
    An array of dynamic strings or a filed array of the same? In that case Field variables could be of use for quickly separating the string into it's relevant parts. However, the positioning of the columns would still be an XPRINT SET POS task, since it seems apparent the length of the field variables is probably going to be less than the column widths. Is that correct?

    Maybe you have already planned on that? Several ways to do the task, but the first case is that you would print a line of columns, although there are other types of data that want to be printed newspaper style. I think the example I cited earlier uses the latter. But for any who have not done this it's pretty simple to do either method.

    Leave a comment:


  • Cliff Nichols
    replied
    Right at the moment, I plan on fixed font (like Courier) but the number of fields is unknown at compile time, so I was looking at how I could use an array and fill the columns with data.

    Leave a comment:


  • Richard Angell
    replied
    Cliff,

    Fields partition data in the circumstances listed in the help.

    However, printing except with a fixed width font, will have no guarantee of columnar location just because data is fielded. Printing with a typical, proportional font using a Windows printer requires that the code set each column's horizontal position on the line. Once you set the position you could print using a FIELD variable if so desired. See XPRINT GET/SET POS functions.

    Also you can see an example of columnar printing to screen and to Windows printer in PBWin90\Samples\Ddt\Graphic\boltcalc example (also with PBWin80 ... similar path).

    Leave a comment:


  • Michael Mattias
    replied
    You mean the FIELD datatype? The fields collection/field object provided by ADO? The FIELD statement?

    Based in "printing columns" I think you may mean the FIELD statement, as in

    Code:
    FIELD OutputLine$,  15 AS ColumnOne$, 15 as ColumnTwo$ ....
    
       ColumnOne$ = "value1"
       ColumnTwo$ = "value 2"
      ...
       PRINT #hOut, OutputLine$
    Something like that?

    FILED difference from UDT? Column sizes are dynamic, not fixed at compile time.

    MCM

    Leave a comment:


  • Cliff Nichols
    started a topic Field

    Field

    I am trying to understand how "Fields" works. Or more specifically I would like to perhaps use it to print a file of columns 1 column may be 15 spaces wide, while the 2nd may be 30 spaces wide and yet a 3rd may only be 5 spaces wide.

    Now if Fields is what I need so I can say
    Field1 = "Some Command"
    Field2 = "Some Comment"
    Field3 = "Some Line Number"

    Does anyone have a compilable example that does that? Or am I way off base how Fields are used?
Working...
X
😀
🥰
🤢
😎
😡
👍
👎