on 03-11-2015 2:56 AM
I have a Crystal Report (using CR 2008) that has three database queries (the below is sourced from the "Show SQL" menu option)
MYSERVER "mydb"."dbo"."run_report";1 {d '2000-01-01'}, {d '2015-01-01'}, 'A12345'
MYSERVER select SUser_SName() as [CurrentUser]
MYSERVER select parent_name from containers where id = '{?@id}'
None of these queries depend on each other, although the first and last queries use the same input parameter - @id
(which is A12345
in this example)
The above works fine when the run_report
stored procedure returns > 0 results. When it returns no results (but no actual errors as far as I can tell), the second and third SQL queries don't appear to be executed as their results (which are inserted into the report as fields) are just blank.
I can see two possible approaches to the issue:
...but I'm not sure how to achieve either approach.
(This is a cross-post from http://stackoverflow.com/q/28956976/79450 )
Hello Andrew,
Solution A,
add to the run_report stored procedure if there is not return value, it must return and empty line with NULL values.
it will have always return value (an empty row with NULL values in each column) so it will process the next statements.
Solution B,
Separate your report using +2 subreports
- main report executes the command: MYSERVER
"mydb"."dbo"."run_report";1 {d '2000-01-01'}, {d '2015-01-01'}, 'A12345'
- 1st subreport executes next command
MYSERVER select SUser_SName() as [CurrentUser]
-2nd subreport executes the next command
MYSERVER select parent_name from containers where id = '{?@id}'
Each solutions are good
János
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks János. I used the first approach and it worked fine.
Many thanks,
Andrew
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.