I tried to use the global variables "totalpages" in my table footer to decide whether to hide or show if there are no records from the dataset.
But then I found out that global variables can only be used in page header/footer.
Is there any way i could check whether there's records returned, and hence control the visibility.
Thanks.Good Evening!
Right or wrong - but never mind me using stored procs for everything!
For ALL MS RS reports we use stored procedures - for everything...
So in every stored proc we count records in a lot of various ways - but primarily we use in the first line
Select
Count(1) as Expr1 - Expr1 is our indicator that data has been populated within the SQL Select for all records processed (may have some records or not)
You should never use Count(*) anyway because it does another "scan" of the DB to get the result...
So within MS RS the first thing we do is inspect EXPR1 for a value
No Value
Display "Selection Parameters Found No Information For Your Request" in a text box that was added to the Header of the Report
Else
Display the data within MS RS.
The header text box has an IIF condition and we BOLD in RED so it is visible for the users who do not like to read what they are getting
I don't know how to do if the SQL Select was a "TEXT" string versus a stored procedure! Probaly just as easy - I guess....
We have also in a lot of instances where we use a SQL Stored Proc driver which means and it works really nice if you have SELECTS <= 8000 characters...
We already know the fields to populate the MS RS REport so we just take the parameters passed - look up in a table the SQL for the particulare MS RS report and insert the parameters passed by MS RS so we always get a return value(s) from the SQL Stored Proc driver that performs and EXEC for the SQL select we pull from the table and then declare and insert in the SQL script the values the user passed from MS RS.
So the return value from the EXEC is passed back to use and we cast as EXPR1.
I got to "woordy" here - but nevertheless - I would hope that not only for no data from a Select is captured but also other error situations that might occur as well - so you can pass this information back as well especially if your environment is OLTP versus a warehouse...
Best regards
|||
eeyore21,
CountRows(Scope) where Scope is your dataset. ex: Place=IIF(CountRows("MyDataset") = 0, True, False) as Visibility->Hidden->Expession for your object that you want to hide/show based on record count.
Hope this helps,
Mike
Thanks,
It sure helps alot.
No comments:
Post a Comment