DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: How to use report for more than one tables ?

  1. #1
    desigar Guest

    How to use report for more than one tables ?


    Hi friens...

    I am new to this discussion forum and I am not sure how much it will be worth...

    I have a problem with Report feature of Vfp and not able to get answer for
    it since long time...

    Usually, report can be created with only one base table. Suppose, I have
    two different tables and I want print to take printout of those tables one
    by one continuously.

    For example :

    sele a
    use test1 && contains 3 records
    sele b
    use test2 && contains 3 records
    sele c
    use test3 && contains 2 records

    Now I want my output in a single paper like,

    contents of test1
    -------
    --------
    --------
    contents of test2
    -------
    -------
    -------
    contents of test3
    -------
    -------

    For above printout as for as my knowledge, report generator requires three
    pages for three different base tables, which I feel meaningless.

    I am working in foxpro2.5 since last two years and new to Vfp5.0. We are
    taking printout thru programs as it gives me more flexibility and we never
    uses report of foxpro because of this constraint.

    thanks in advance

    natrajv
    mumbai,India






  2. #2
    Rick Bean Guest

    Re: How to use report for more than one tables ?

    Assuming the tables have the same data structure, you can use an SQL SELECT
    and UNION the three tables into a single cursor and run the report with it's
    data.

    If the tables (and detail lines) are different for each table, you just need
    to make the UNION a bit more complex, and include overlapping fields on the
    report with "smart" Print When clauses.

    Rick

    "desigar" <desigar@indiatimes.com> wrote in message
    news:3cd7d2b4$1@10.1.10.29...
    >
    > Hi friens...
    >
    > I am new to this discussion forum and I am not sure how much it will be

    worth...
    >
    > I have a problem with Report feature of Vfp and not able to get answer for
    > it since long time...
    >
    > Usually, report can be created with only one base table. Suppose, I have
    > two different tables and I want print to take printout of those tables one
    > by one continuously.
    >
    > For example :
    >
    > sele a
    > use test1 && contains 3 records
    > sele b
    > use test2 && contains 3 records
    > sele c
    > use test3 && contains 2 records
    >
    > Now I want my output in a single paper like,
    >
    > contents of test1
    > -------
    > --------
    > --------
    > contents of test2
    > -------
    > -------
    > -------
    > contents of test3
    > -------
    > -------
    >
    > For above printout as for as my knowledge, report generator requires three
    > pages for three different base tables, which I feel meaningless.
    >
    > I am working in foxpro2.5 since last two years and new to Vfp5.0. We are
    > taking printout thru programs as it gives me more flexibility and we never
    > uses report of foxpro because of this constraint.
    >
    > thanks in advance
    >
    > natrajv
    > mumbai,India
    >
    >
    >
    >
    >




  3. #3
    Cindy Winegarden Guest

    Re: How to use report for more than one tables ?

    Rick Bean <rgbean@NOSPAMmelange-inc.com> wrote in message
    news:3cd7e3bd$1@10.1.10.29...
    > Assuming the tables have the same data structure, you can use an SQL
    > SELECT and UNION the three tables into a single cursor and run the
    > report with it's data.
    >
    > If the tables (and detail lines) are different for each table, you
    > just need to make the UNION a bit more complex, and include
    > overlapping fields on the report with "smart" Print When clauses.


    To go a little further with the "overlapping fields" concept, have a
    look at http://fox.wikis.com/wc.dll?Wiki~Mul...ProReports~VFP for
    some ideas.

    --

    Cindy Winegarden MCSD, Microsoft MVP
    cindy.winegarden@mvps.org http://cindywinegarden.adsl.duke.edu
    http://msdn.microsoft.com/vfoxpro http://foxcentral.net





  4. #4
    Desigar Guest

    Re: How to use report for more than one tables ?


    Dear Cindy Winegarden...

    Thanks for your help ... I visited that link and find some useful hints...


    My data structures are not same and UNION will not work...

    I tried that overlapping fields and it working fine... further I did see
    your cool code... it's really good...

    Still, I need help from you...

    1. I like to give some comments when report jumps into next table.
    I prefer to give atleast 05 lines of comments between that time. As per your
    code I think it is not possible.

    For Example I want like this output :

    Printing Table-1 from multichild cursor
    -------- && printing records
    -------- && printing records
    printing Table-2 from cursor
    *** here I want to give atleast 05 lines of comment without breaking
    pages***
    -------- && printing table-2 records
    -------- && printing table-2 records

    and this cycle continues till all the records are printed.

    Once again, I like to thank you...

    Expecting your reply eagerly,

    sincerely
    desigar, Mumbai, India

    _______________________________________________________________


    "Cindy Winegarden" <cindy.winegarden@mvps.org> wrote:
    >Rick Bean <rgbean@NOSPAMmelange-inc.com> wrote in message
    >news:3cd7e3bd$1@10.1.10.29...
    >> Assuming the tables have the same data structure, you can use an SQL
    >> SELECT and UNION the three tables into a single cursor and run the
    >> report with it's data.
    >>
    >> If the tables (and detail lines) are different for each table, you
    >> just need to make the UNION a bit more complex, and include
    >> overlapping fields on the report with "smart" Print When clauses.

    >
    >To go a little further with the "overlapping fields" concept, have a
    >look at http://fox.wikis.com/wc.dll?Wiki~Mul...ProReports~VFP for
    >some ideas.
    >
    >--
    >
    >Cindy Winegarden MCSD, Microsoft MVP
    >cindy.winegarden@mvps.org http://cindywinegarden.adsl.duke.edu
    >http://msdn.microsoft.com/vfoxpro http://foxcentral.net
    >
    >
    >
    >



  5. #5
    Cindy Winegarden Guest

    Re: How to use report for more than one tables ?

    Desigar <desigar@indiatimes.com> wrote in message
    news:3cd94f92$1@10.1.10.29...
    > My data structures are not same and UNION will not work...


    You might be able to UNION your tables if you have fields from Table1
    and then fields from Table2 in your cursor. Something like:

    SELECT Table1.Field1, Table1.Field2, ;
    0000.0000 AS Field3, SPACE(10) AS Field4 ;
    UNION ;
    (SELECT {} AS Field1, .F. AS Field2, ;
    Table2.Field1 AS Field3, Table2.Field2 AS Field4 ;
    ......

    > 1. I like to give some comments when report jumps into next
    > table. I prefer to give atleast 05 lines of comments between that
    > time. As per your code I think it is not possible.
    >
    > For Example I want like this output :
    >
    > Printing Table-1 from multichild cursor
    > -------- && printing records
    > -------- && printing records
    > printing Table-2 from cursor
    > *** here I want to give atleast 05 lines of comment without
    > breaking pages***
    > -------- && printing table-2 records
    > -------- && printing table-2 records
    >
    > and this cycle continues till all the records are printed.


    It looks like you need a report variable which counts records, and then
    do some math to group on an even multiple of 2. Try CEILING(Variable /
    2) = Variable / 2.

    If that doesn't work, try some Xbase code to add or insert 5 comment
    records into your table.

    --

    Cindy Winegarden MCSD, Microsoft MVP
    cindy.winegarden@mvps.org http://cindywinegarden.adsl.duke.edu
    http://msdn.microsoft.com/vfoxpro http://foxcentral.net





Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center