DataSource.SetBookmark() method doesnt work as expected

Posted by: d.lipiec on 7 October 2020, 7:54 am EST

  • Posted 7 October 2020, 7:54 am EST

    Hi,

    I’m using C1.Win.C1Report.2 + C1.Win.C1ReportDesigner.2 which are embedded into QAD ERP application (this is .NET app).

    I designed report with main report/datasource, and one subreport.

    Subreport uses only “Detail” section.

    I want to print every page of report 4 times.

    The sequence of printing is important as I’m going to use coloured paper sheets.

    I want 1st page to be printed 4 times, then 2nd page 4 times, and so on.

    To do this I designed layout, and added couple VB script code to it including DataSource.SetBookmark() call.

    My report correctly render 1st page (let’s say lines 1-5 are printed), but 2nd page is rendered incorrectly (it prints lines: 6,2-5 instead of 1-5) ignoring “SetBookmark(0)” call – pls see below VB code.

    I suspect line “6” is cached somehow.

    How can I reset cache or force lines “1-5” to printed on 2nd page properly.

    BR

    if cntCopies < 3 then
      hasData = white_page.Subreport.DataSource.SetBookmark(0)
    end if
    
  • Posted 8 October 2020, 6:16 am EST

    This is update my own post.

    It’ seems SetBookmark() method works but in my case, it must fired in the right moment.

    Attach my VB code added to “OnFormat” of subreport’s “Detail” section.

    This code causes my first page of report is repeated 4 times (as expected), but second page (also last one) is not repeated (is printed only once).

    Maybe someone has any idea, what to do to force 2nd page to be repeated as well.

    BR

    bflag = (cntCopies < 3) and (white_page.Subreport.DataSource.GetBookmark mod 5 = 4)
    if bflag = true then
       hasData = white_page.Subreport.DataSource.SetBookmark(cursorPosition)
    end if
    
  • Posted 8 October 2020, 6:30 am EST

    Hello,

    Can you share the report and dummy db so that I can replicate issue at my end.

    Also, C1Report is in maintenance mode after 2016v1. So I suggest you to migrate to the FlexReport to get new feature and support.

    Some useful link:

    https://www.grapecity.com/forums/winforms-edition/c1report-in-maintenance-mo_1

    https://www.grapecity.com/componentone/docs/win/online-flexreport/C1ReporttoFlexReportBreakingChanges.html

    https://www.grapecity.com/blogs/3-ways-to-convert-your-c1report-to-flexreport

    Please share the exact version are you using. Also, I request to check the same with the last version of C1Report. You can download the same from the following link:

    https://www.grapecity.com/componentone/download

    Thanks,

    Mohit

  • Posted 8 October 2020, 1:45 pm EST - Updated 4 October 2022, 7:49 am EST

    Hello Mohit,

    Below is my report.

    I want this page to be printed 4 times with use of VB scripting (our QAD ERP application allows us to use VB script only).

    I realize (C1.Win.C1Report.2 + C1.Win.C1ReportDesigner.2) are bit oudated, but they are part of our corporate QAD ERP application and can not be (?) upgraded.

    Can you tell me is’t possible to write some VB code for “OnFormat” or “OnPrint” triggers of “Detail” section is order to re-print page, let’s say 4 times.

    Thanks in advance for reply.

    BR

  • Posted 9 October 2020, 4:40 am EST

    Hello,

    Can you tell me is’t possible to write some VB code for “OnFormat” or “OnPrint” triggers of “Detail” section is order to re-print page, let’s say 4 times.

    There is only way to repeat the page to 4 times, to use the current report as SubReport in the other report and bind the Main report with data which make the detail section to render 4 times. It is only way to achieve this.

    Thanks,

    Mohit

  • Posted 9 October 2020, 10:03 am EST

    Hi Mohit - thanks for reply. Currently mentioned “Detail” section is part of subreport. What I shall to do next to print page 4 times.

  • Posted 11 October 2020, 5:43 am EST - Updated 4 October 2022, 7:49 am EST

    I can not supply dummy db – report designer and rendering engine are embedded into our corporate QAD ERP application (.NET app). Application use PROGRESS DB to store data.

    Pls see below attached screenshots of our report designer tool.

    First one, shows main report and subreport on left, and report layout on the rigth.

    Second, shows subreport definition along with “Detail” section layout.

    Report properties, triggers, etc.(template) are on the down-left.

    I have access to “OnFormat” and “OnPrint” triggers and I can use some sub-set of VB script syntax.

  • Posted 14 October 2020, 3:39 am EST

    Hello,

    We are very sorry for the delay!

    I just want you to bind the MainReport with Dummy data which contains the Four Items. This leads to detail section of the MainReport renders 4 times.

    Hope it helps.

    Thanks,

    Mohit

  • Posted 14 October 2020, 4:03 am EST

    hmm … I came up with similar conclusions:

    a\ there is no way to print “Detail” section (with BLUE markers on screenshot) 4 times unless underlaying data will be duplicated 4 times

    b\ if I want to print 5 data items (5 lines), but there is enough space in “Detail” to print only 4 lines, then I have to prepare 5 times 4 = 20 lines of data and sequence them: 1-4, 1-4, 1-4, 1-4, 5, 5, 5, 5 — this was all 5 lines will be printed in a sequence I need and 4 copies.

    This is not the end of story as some actions to OnFormat and OnPrint are still required, but enough for me now. Thanks for your time.

  • Posted 28 November 2023, 12:25 am EST

    Hi, can you explain again step by step on how to print the whole report for 4 times?

  • Posted 29 November 2023, 10:00 pm EST

    Hi Somalaksmi,

    In the previous conversation, the customer wanted to repeat the “Detail” section four times. However, your statement suggests that you might be asking for the entire report to be printed four times.

    Could you please confirm which of the following you need:

    1. Printing the whole report four times.
    2. Printing each page of the report four times.

    If your requirement is different, please let us know.

    Thanks & Regards,

    Aastha

  • Posted 29 November 2023, 10:31 pm EST

    Hi

    Printing the whole report 4 times.

  • Posted 1 December 2023, 5:50 am EST - Updated 1 December 2023, 5:55 am EST

    Hi Somalakshmi,

    Here are some of the solutions based on the possible use-cases:

    1. Render the FlexReport 4 times in the FlexReportDesigner - If you want to render the report 4 times in the designer, you have to create a main report. Then add the report to be printed multiple times as the subreport of the main report. Kindly refer to the attached report file for reference. See MultipleCopies.zip

    For more details refer here: https://developer.mescius.com/componentone/docs/win/online-flexreport/SubreportField.html

    1. Print multiple copies of a report via FlexReportDesigner - You can refer to the following GIF for the same:

    1. You can print the flexreport 4 time via code-behind using the following code-snippet:

    rep.DefaultPrintOptions.PrinterSettings = new System.Drawing.Printing.PrinterSettings() { Copies = 4 };
    rep.Print();

    Check

    PrintMultiple.zip for reference.

    Thanks & Regards,

    Aastha

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels