Dataset record id

YSHYSH
edited 3:09PM in FastReport VCL
Hi everyone,
Wondering if enyone knows how to get a dataset record id?

Comments

  • edited 3:09PM
    YSH wrote: »
    Hi everyone,
    Wondering if enyone knows how to get a dataset record id?

    What are you asking for? The current record number? That is usually not a useful piece of information, since the order of the records is changed by ORDER BY clauses, etc.

    More to the point, what is it you are trying to do/show?

    Rick Brodzinsky
  • YSHYSH
    edited 3:09PM
    brodzins wrote: »
    brodzins wrote: »
    Hi everyone,
    Wondering if enyone knows how to get a dataset record id?

    What are you asking for? The current record number? That is usually not a useful piece of information, since the order of the records is changed by ORDER BY clauses, etc.

    More to the point, what is it you are trying to do/show?

    Rick Brodzinsky

    Yes, the current record number. In my case, that would solve my issue.
    I have multiple datasets, the row order always the same (the source order). The idea is to mark up some rows at the first pass and adjust a report at the second pass when i get a marked row.
  • edited 3:09PM
    Have you looked at the System Variable [Line]? It will number the lines(rows) of a report. If your records are always in the same order, this should then correspond to the record number.

    One idea, in your band???s OnBeforePrint event, can you assign your dataset???s RecNo property to a variable and print that in the record? (Have not tried this, might give it a shot tomorrow)

    Rick Brodzinsky
  • edited 3:09PM
    Yep, my idea seems to work, but only with the FireDac components. They seem to be the only ones which publish a Record Number property from the underlying TQuery object.

    First, define a Report Variable named RecNo

    In the code section (fdqReg is a TfrxFDQuery)
    var
      RecNo : longint;
    
    procedure MasterData1OnBeforePrint(Sender : TfrxComponent);
    begin
      RecNo := fdqReg.FDRecNo;
      set('RecNo',RecNo);
    end;
    

    Then, in the master data band, place a TfrxMemoView with [RecNo] as its contents.

    Rick Brodzinsky
  • YSHYSH
    edited 3:09PM
    brodzins wrote: »
    Yep, my idea seems to work, but only with the FireDac components. They seem to be the only ones which publish a Record Number property from the underlying TQuery object.

    First, define a Report Variable named RecNo

    In the code section (fdqReg is a TfrxFDQuery)
    var
      RecNo : longint;
    
    procedure MasterData1OnBeforePrint(Sender : TfrxComponent);
    begin
      RecNo := fdqReg.FDRecNo;
      set('RecNo',RecNo);
    end;
    

    Then, in the master data band, place a TfrxMemoView with [RecNo] as its contents.

    Rick Brodzinsky

    This works for me.
    Thank you, Rick!

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.