DataSource.SetBookmark() method doesnt work as expected

Posted by: d.lipiec on 6 October 2020, 10:54 pm EST

  • Posted 6 October 2020, 10:54 pm 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


  • Replied 7 October 2020, 9:16 pm 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
  • Replied 7 October 2020, 9:30 pm 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
  • Replied 8 October 2020, 4:45 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
  • Replied 8 October 2020, 7:40 pm 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
  • Replied 9 October 2020, 1: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.
    --
  • Replied 10 October 2020, 8:43 pm 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.

  • Replied 13 October 2020, 6:39 pm 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
  • Replied 13 October 2020, 7:03 pm 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.
Need extra support?

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

Learn More

Forum Channels