Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: New to DataFlex Reports

  1. #1
    Join Date
    Jun 2016
    Location
    Point Cook, Victoria, Australia
    Posts
    572

    Default New to DataFlex Reports

    Hi Everyone,

    I have recently upgraded to DF19.1 and DR7.0

    Prior to this I did my developing with DF18.2 exclusively, although I did have DR6.0, but never had much of a chance to use it.

    Anyway, I have a couple of questions which someone might be able to answer, or give their opinion.

    First, as I'm now beginning to develop DF Webapps, I've decided I'll use DR7.0 for reports. Is it best to simply go into DR and design a "native" report, or is it better to design reports using RDS?

    I've done a couple of sample reports and even though DR is a bit daunting to begin with, I was able to design a fairly swish looking report. It was a single file report, but hey, I've got to start somewhere, lol.

    One thing I did try to do and couldn't find how to do it, was to print the criteria of the report on the actual report, i.e., choosing clients who have purchased something during July 2019, I would want something like: "Criteria: 01/07/2019 to 31/07/2019" printed at the bottom of each page of the report.

    Could someone kindly explain how to accomplish this. In simple terms please, as I'm still on my "P" plates, lol.
    Regards,
    Rachael Warlond

    1) When programming, never reinvent the wheel.
    2) If it works, leave well enough alone.

  2. #2
    Join Date
    Feb 2009
    Location
    Somewhere in Vermont, USA - unless I'm not
    Posts
    11,085

    Default Re: New to DataFlex Reports

    Hi Rachael -

    IMO, definitely RDS for 2 reasons: 1) no ODBC needed on machines running the report & 2) you fill the RDS table(s) from DF code - whether from embedded SQL or straight DF. This means you can do all your massaging of the info, fill made up fields, etc. & simply set the values in the struct. Filling fields in DF code means fewer functions & such in the DR. For example, if an order line record doesn't have a total field - just quantity & price - put a total field in the RDS table, fill it with (Qty*Price) & then just display it on the report.

    While I haven't looked @ 7 much, the earlier versions are lacking in RDS help. What I'd recommend is to create a little report in DR using RDS data. Fill in some sample data & see how it displays. Then run the wizard in DF & it'll create all the basic code for what needs to go into the RDS table. Then write code to fill the struct & compile the RV & run it.

    For the criteria, an RDS report doesn't have any (it's in the DF code) - so I'd throw in a text object with the info.

    HTH
    Garret

    Time for an oldie but goodie:

    "If it ain't broke, you're not trying." - Red Green

  3. #3
    Join Date
    Jun 2016
    Location
    Point Cook, Victoria, Australia
    Posts
    572

    Default Re: New to DataFlex Reports

    Thank you for that Garret.

    I must admit that I did find producing the couple of "native" DR reports that I've done just playing around, was rather cumbersome. I much prefer the "hands-on" approach and just design the basics using the WYSIWIG UI and then finish it off in DF code. It's usually a much more flexible approach.

    I'm thinking that doing extra bits and pieces, like the criteria that I spoke about, for example, is probably much easier to do in RDS as well. I also like the idea of actually seeing the code in the case of RDS, rather than having most of it hidden in a DR file.

    I will be asking a bit about inner joins too, as one report that I wish to do is like a DF header/details view, but in the form of a report. The old Winprint2 was easy, and at least one could see all the code as well, and then understand how it all fitted together. Getting my head around DR is a bit like trying to understand voodoo at the moment, but if I can see more code, as in RDS, I'm sure I'll understand it better, as well as more quickly.

    Thank you for your assistance.
    Regards,
    Rachael Warlond

    1) When programming, never reinvent the wheel.
    2) If it works, leave well enough alone.

  4. #4
    Join Date
    Feb 2009
    Location
    Somewhere in Vermont, USA - unless I'm not
    Posts
    11,085

    Default Re: New to DataFlex Reports

    For header/detail, I set up 2 tables and in the report join them by an ID field. Fill the header table with whatever & set the ID to 1. Fill the lines tables with x number of lines & set the ID field for each to 1. Of course you could use an order # or whatever to link on. Just be aware that multiple tables have to be related somehow in the report.

    If your criteria will change, set a parameter to the string in the RV & display the parameter in the report with a function.
    Garret

    Time for an oldie but goodie:

    "If it ain't broke, you're not trying." - Red Green

  5. #5
    Join Date
    Feb 2009
    Location
    Adelaide, South Australia
    Posts
    2,863

    Default Re: New to DataFlex Reports

    Hi Rachel

    Use the new report wizard from 19.1, then select RDS and then select your tables and fields.

    It will create all code and a basic dr report.
    Then change the selection criteria from dr formula to RDS data selection.

    For passing text, use formula’s
    - create a formula like ‘selectionCritera’ in dr.
    - set the value in your dataflex code

    Ps join the DataFlex conference in Melbourne this September. There is also DataFlex reports training. Www.ddug.org

    Kind regards
    Marco
    Marco Kuipers
    DataFlex Consultant
    28 IT Pty Ltd - DataFlex Specialist Consultancy
    DataFlex Channel Partner for Australia and Pacific region
    Adelaide, South Australia
    www.28it.com.au

  6. #6
    Join Date
    Feb 2009
    Location
    Hengelo, Netherlands
    Posts
    10,869

    Default Re: New to DataFlex Reports

    Rachel,

    For displaying the selection criteria in the report results there are two solutions provided.

    1. If you use a selection formula you can print this via a special field. For an example check OrderList.dr (weborder example)
    2. If you use the filter expert you can print the filter function via integration. For an example check the Customer List.dr (order entry example)

    The regarding RDS or not; RDS is needed when your data does not come from a regular database (such as a webservice, directory, text file) and is also highly recommended when you want to do data processing and printing at the "same" time (for example printing the orders and flag them as printed/shipped etc. While RDS is a good data-source there are no indexes available and thus linking two RDS rows together is slower than in ODBC or embedded DataFlex. This does not have to be a problem for you. One of the real drawbacks of RDS is that you need to change your application and redistribute when a new column is needed in the report upon user request. With the other data-sources the report can be changed and that's it. OTOH, it might be preferable as you will have more contact with the customer and even earn money on making changes.

    And as Marco says; Come to DAPCON.
    Regards,
    Data Access Worldwide
    Vincent Oorsprong

  7. #7
    Join Date
    Jun 2016
    Location
    Point Cook, Victoria, Australia
    Posts
    572

    Default Re: New to DataFlex Reports

    Ok, thank you all.

    I was quite busy yesterday, Melbourne-time, so I didn't see your replies. All good information, so thank you for that. I'll have a look at OrderList.dr and Customer List.dr today.

    Another thing that I have noticed is that I've changed the options in DR to print dates as dd/MM/yyyy with 24-hour time. I've noticed, however, that dates are printed as MM/dd/yyyy with 12-hour time for both DR's functions, i.e., "Date Date and Time" and "Print Date and Time" and also dates within the report data, even though I've changed the column's properties with a short date - the radio DMY is selected as well. How is this changed? Date/time produced by DF19.1 are fine, BTW.

    In regards to the conference, it sounds like a good idea if I do come along. I'm sure I'll come away far more enlightened, than if I didn't go.

    Regards,
    Rachael Warlond

    1) When programming, never reinvent the wheel.
    2) If it works, leave well enough alone.

  8. #8
    Join Date
    Feb 2009
    Location
    Somewhere in Vermont, USA - unless I'm not
    Posts
    11,085

    Default Re: New to DataFlex Reports

    Try File, Options, Formatting tab? Dunno if it'll fix the date thing, as I live in the States where we use mm/dd/yyyy - though dd/mm/yyyy makes more sense. Of course we still use inches & feet too...
    Garret

    Time for an oldie but goodie:

    "If it ain't broke, you're not trying." - Red Green

  9. #9
    Join Date
    Feb 2009
    Location
    Hengelo, Netherlands
    Posts
    10,869

    Default Re: New to DataFlex Reports

    Rachael,

    I've logged the print date/time issue but I cannot reproduce. In the HDE ticket I attached the test report. See what it does on your side.
    Regards,
    Data Access Worldwide
    Vincent Oorsprong

  10. #10
    Join Date
    Jun 2016
    Location
    Point Cook, Victoria, Australia
    Posts
    572

    Default Re: New to DataFlex Reports

    Hi Vincent,

    This is another thing to do with dates. Hopefully, you'll be able to reproduce this one as I think it would be much easier to reproduce, especially because it's displaying military time with the year, month and day separated by "-".

    This does come up with an error when the DR report is run, which I'm not sure why, but it does display the two dates in the incorrect format, which is why I'm using "FormatDate" to try to rectify it.

    The regional settings on my computer are set to "dd/MM/yyyy" and the time is set to 24-hour, although this doesn't show the time of course. I'm also starting the WebApp using localhost and the WebApp displays dates perfectly.

    The first line is in the DF19.1 WebApp report code.

    The lines starting with "let" through to "return (s)" is in a DR function in a .DR file, while the last line is what is actually printed in the DR report.

    Of course, I'm trying to display "From 01/08/2017 to 31/08/2017" on the report, but the code in the DR function has something (yet to figured out) not quite correct.


    Code:
    //DF19.1 WebApp:
    Set psFilterFunction sReportId to ('From ' + "FormatDate(" + sTripTmpStartDates[0] + ",drCustomDateMask,'dd/MM/yyyy')" + ' to ' + "FormatDate(" + sTripTmpStartDates[1] + ",drCustomDateMask,'dd/MM/yyyy')")
    
    //DR7.0 function:
    let s = Replace({&Filter Function}, '"', "")
    let s = Replace(s, '"', "")
    let s = Replace(s, '"', "")
    let s = Replace(s, '"', "")
    let s = Replace(s, '"', "")
    let s = Replace(s, '"', "")
    let s = Replace(s, '"', "")
    let s = Replace(s, '"', "")
    return (s)
    
    //Print result within the actual report:
    From FormatDate(2017-08-01,drCustomDateMask,'dd/MM/yyyy') to FormatDate(2017-08-31,drCustomDateMask,'dd/MM/yyyy')
    
    
    Last edited by Rachael; 14-Aug-2019 at 03:42 PM.
    Regards,
    Rachael Warlond

    1) When programming, never reinvent the wheel.
    2) If it works, leave well enough alone.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •