Printing from SalReportView()

SqlBase and Centura Solutions
yoanstillwater

Printing from SalReportView()

Post by yoanstillwater » 12 Feb 2009, 11:33

Hi everyone,

My problem is that when I press the print button in the window created by SalReportView(), a blank page prints.

I have seen that a developer had exactly the same problem in this forum and his answer was :

'What happens is, after the initial display to the report window, SAM_ReportFetchInit and Sam_ReportFetchNext are sent AGAIN when printing and AGAIN when redisplaying the report window! The same thing is true with zooming. So, you need to make sure your code in the message handlers reset so the data is selected again. In my case before returning FALSE in SAM_ReportFetchNext (when no more data) I had to issue the select again to prime for the next run through.'

I agree but I don't see exactly what code I have to write or which function I have to use in order to 'issue the select again to prime for the next run through'

Thanks for help.

User avatar
Steve Leighton
Site Admin
Site Admin
New Zealand
Posts: 463
Joined: 05 Mar 2017, 20:57
Location: Stroud, England <--> Tauranga, New Zealand

Re: Printing from SalReportView()

Post by Steve Leighton » 18 Feb 2009, 19:53

Firstly can you tell if the 'Print' button you talk about is programmer defined, with code behind it, or the default one supplied by ReportBuilder.
Greetings from New Zealand
Steve Leighton

Bankside Systems Ltd.
UK ♦ Australia ♦ New Zealand

www.banksidesystems.co.uk

Image

yoanstillwater

Re: Printing from SalReportView()

Post by yoanstillwater » 19 Feb 2009, 04:42

The 'Print' button is the default one ( supplied by ReportBuilder )

User avatar
Steve Leighton
Site Admin
Site Admin
New Zealand
Posts: 463
Joined: 05 Mar 2017, 20:57
Location: Stroud, England <--> Tauranga, New Zealand

Re: Printing from SalReportView()

Post by Steve Leighton » 07 Mar 2009, 22:37

You must be calling SqlPrepareAndExecute() somewhere - it should be where you trap SAM_ReportFetchInit.
This is where you first set up you SQL (select)statement, then call SqlPrepareAndExecute()using that SQL statement.
SAM_ReportFetchInit will fire every time you view or print, and hence so will your SQL statement be re-prepared every time.
If you trap SAM_ReportFetchNext, you can call SqlFetchNext()and (optionally) customise the result-set before it is sent to the report.
To send data to the report depending
upon the report level ( eg about to format the page header etc) trap "SAM_ReportNotify".
Greetings from New Zealand
Steve Leighton

Bankside Systems Ltd.
UK ♦ Australia ♦ New Zealand

www.banksidesystems.co.uk

Image

Return to “TekTips”

Who is online

Users browsing this forum: [Ccbot] and 0 guests