UserDataSet

Leo BidiLeo Bidi Montevideo, Uruguay
edited 12:00AM in FastReport 4.0
I need to print some selected records of a grid , was told to use userdataset instead of dbdataset.

I know that I must link the report to the userdataset but what
I dont know is how to fill this userdataset with the desired columns of my grid.

I've seen the demo for printing arrays but even cant find the way to do what I need.

Any piece of sample code would be very appreciate.

Regards

Leo



Comments

  • edited 12:00AM
    I assume that at certain moment you can gather ID of rows you want to print - you have them multiselected on the grid so you are able to read those IDs.

    1. Prepare another query (TADOQuery or any you use with your database engine)
    2. Let this query looks like select * from table T
    3. When you know your IDs make a dynamic (on-fly) change to your TADOQuery

    TADOQuery.SQL.Add( ' where T.id in (' + String_of_your_IDs_comma_seperated + ')') --> add space before where !

    4. Do TADOQuery.Open
    5. Use this TADOQuery with any band you need

    Mick

  • gpigpi
    edited 12:00AM
    See a small demo project in attach
  • Leo BidiLeo Bidi Montevideo, Uruguay
    edited 12:00AM
    Thanks so much both for your help.

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.