Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Print FreeForm report in Group Footer of another Freeform report

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

  • Print FreeForm report in Group Footer of another Freeform report

    Hi
    Backend is MariaDB
    I am trying to print a basic "Invoice Receipt" document. It is an invoice-receipt document from the invoice-receipt tables (primary key InvoiceReceiptID), which has, for each one, a list of products sold, saved in InvoiceReceiptProducts, and a list of payments for each invoice-receipt, saved in InvoiceReceiptPayments.

    The only way i found in Alpha to print the document with the list of products is by basing the SQL Datasource on InvoiceReceiptProducts, then grouping the report by InvoiceReceiptID. The report is filtered by whatInvoiceReceiptID to output just one document.

    I also have an InvoiceReceiptPayments report (also filtered by InvoiceReceiptID) that i would like to embed in the group footer of the main report, alas, linked reports have to be layout reports ( the InvoiceReceiptPayments report is freeform and has many conditional areas ), and the sub-report option does not seem suitable ( the documentation for sub-reports is ambiguous to say the least) particularly since, contrarily to the documentation, i didn't find a way to create a one-to-many relationship between the tables.

    Has any of you an idea on how to achieve the above? I am surprised it's so difficult to implement such a basic reporting feature.

    Many thanks
    Jaime

  • #2
    Re: Print FreeForm report in Group Footer of another Freeform report

    For this I would create the list of receipts as an HTML table and then use printhtml to print the table.

    I use a function to go through the records and create an HTML table that I then print directly from the report.

    But to do that you need to know how to write the SQL function. If that option will not work for you, then hopefully someone else will chime in.

    Comment


    • #3
      Re: Print FreeForm report in Group Footer of another Freeform report

      Thanks Larry
      How do you construct the html table, and at what stage?

      Comment


      • #4
        Re: Print FreeForm report in Group Footer of another Freeform report

        Below is a typical function that I would write. This one create a table of installment payments.

        Then you call it as part of a select statement:

        select myfunction(myid) as installment_table

        The function is based on using a cursor. A cursor allows you to loop through records in a SQL table.


        CREATE FUNCTION `Installment_Table`(tTrip_ID int) RETURNS varchar(2500)
        READS SQL DATA
        BEGIN
        declare tTable varchar(5000) default '<TABLE border="1" cellpadding="3" cellspacing="2" width="100%"><TBODY><TR><TD><B>Date Due</B></TD><TD align="Right"><B>Amount</B></TD></TR>' ;
        declare tRow varchar(1000) default '' ;
        declare tFinal_Row varchar(1000) default '' ;
        declare tFirst_Row varchar(1000) default '' ;
        declare tFor varchar(25) ;
        declare tFor_Last varchar(25) ;
        declare tI int default 1 ;
        DECLARE done INT DEFAULT 0;
        declare tAdultCount int default 99;

        declare tRowCount int default (select count(Trip_ID) FROM installment_schedule AS Inst
        WHERE Inst.Trip_ID = tTrip_ID) ;

        declare row_cursor CURSOR FOR

        SELECT
        Inst.Installment_for,
        concat('<TR><TD>Upon Registration</TD><TD align="Right">$',
        Inst.Installment_Amount, '</TD></TR>') as First_Row,
        concat('<TR><TD>', date_format(Inst.Installment_Date, '%a %b %D, %Y'), '</TD><TD align="Right">$',
        Inst.Installment_Amount, '</TD></TR>') as Installment_Row,
        concat('<TR><TD>', date_format(Inst.Installment_Date, '%a %b %D, %Y'), '</TD><TD align="Right">$Balance</TD></TR>') as Final_Row
        FROM
        installment_schedule AS Inst
        WHERE
        Inst.Trip_ID = tTrip_ID
        ORDER BY
        Inst.Installment_For, Inst.Installment_Date ;

        DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;

        OPEN row_cursor ;

        FETCH row_cursor INTO tFor, tFirst_Row, tRow, tFinal_Row;

        if tFor <> 'Everyone' then
        SET tTable = CONCAT(tTable, '<TR><TD><b>', tFor, '</b></TD><TD></TD></TR>') ;
        SET tAdultCount = (select count(Trip_ID) FROM installment_schedule AS Inst
        WHERE Inst.Trip_ID = tTrip_ID and inst.Installment_for = tFor) ;
        end if ;

        if tRowCount = 1 then
        set done = 1 ;
        end if ;

        SET tTable = CONCAT(tTable, tFirst_Row) ;

        set tFor_Last = tFor ;

        repeat

        if not done then

        set ti = ti + 1 ;

        FETCH row_cursor INTO tFor, tFirst_Row, tRow, tFinal_Row;

        if not done then

        if tFor <> tFor_Last then
        SET tTable = CONCAT(tTable, '<TR><TD><b>', tFor, '</b></TD><TD></TD></TR>') ;
        end if ;

        IF ti >= tRowCount then

        SET tTable = concat(tTable, tFinal_Row, '</TBODY></TABLE>') ;

        ELSE
        if ti = tAdultCount then
        SET tTable = concat(tTable, tFinal_Row) ;
        else
        SET tTable = concat(tTable, tRow) ;
        end if ;
        END IF ;

        end if ;
        end if ;

        set tFor_Last = tFor ;

        until done end repeat ;

        CLOSE row_cursor ;

        RETURN tTable;

        END

        Comment

        Working...
        X