Showing posts with label runtime. Show all posts
Showing posts with label runtime. Show all posts

Wednesday, March 28, 2012

How To Determine Total Number of Pages at Runtime?

It's no secret that the number of pages in a rendered report varies depending on the format. I have no problem getting the total number of pages for reports rendered in image formats from the web service, but I can't figure out how to get the number of pages for reports rendered in HTML.

I've always been under the impression that the Report Manager that ships with SSRS uses the same web service (reportservice.asmx) and IT can get the number of HTML pages, so it has to be possible.

Does anyone know how to do it?

Bump.|||

I now have a goofy workaround in place that I'll outline here, but I'd still like to know the "right" way to get the total number of pages from the web service.

In case someone is interested, my workaround is:

1. Add a textbox to the footer with the expression:

"***pages: " & Globals!TotalPages & "***"

2. Set the color of the textbox to match the background color (white, in this case).

3. Convert the byte array returned from the ReportingService.Render method to a string.

4. Pick out the number of pages with:

reportText.Substring(reportText.LastIndexOf("***pages: ")+10, reportText.LastIndexOf("***")-reportText.LastIndexOf("***pages: ")-10)

Like I said, goofy, but it will have to do for now.|||

If you would like to see an even goofier workaround, with somewhat more flexibility and potential, you may want to read this thread:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1807270&SiteID=1

>L<

How To Determine Total Number of Pages at Runtime?

It's no secret that the number of pages in a rendered report varies depending on the format. I have no problem getting the total number of pages for reports rendered in image formats from the web service, but I can't figure out how to get the number of pages for reports rendered in HTML.

I've always been under the impression that the Report Manager that ships with SSRS uses the same web service (reportservice.asmx) and IT can get the number of HTML pages, so it has to be possible.

Does anyone know how to do it?

Bump.|||

I now have a goofy workaround in place that I'll outline here, but I'd still like to know the "right" way to get the total number of pages from the web service.

In case someone is interested, my workaround is:

1. Add a textbox to the footer with the expression:

"***pages: " & Globals!TotalPages & "***"

2. Set the color of the textbox to match the background color (white, in this case).

3. Convert the byte array returned from the ReportingService.Render method to a string.

4. Pick out the number of pages with:

reportText.Substring(reportText.LastIndexOf("***pages: ")+10, reportText.LastIndexOf("***")-reportText.LastIndexOf("***pages: ")-10)

Like I said, goofy, but it will have to do for now.|||

If you would like to see an even goofier workaround, with somewhat more flexibility and potential, you may want to read this thread:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1807270&SiteID=1

>L<

sql

How To Determine Total Number of Pages at Runtime?

It's no secret that the number of pages in a rendered report varies depending on the format. I have no problem getting the total number of pages for reports rendered in image formats from the web service, but I can't figure out how to get the number of pages for reports rendered in HTML.

I've always been under the impression that the Report Manager that ships with SSRS uses the same web service (reportservice.asmx) and IT can get the number of HTML pages, so it has to be possible.

Does anyone know how to do it?

Bump.|||

I now have a goofy workaround in place that I'll outline here, but I'd still like to know the "right" way to get the total number of pages from the web service.

In case someone is interested, my workaround is:

1. Add a textbox to the footer with the expression:

"***pages: " & Globals!TotalPages & "***"

2. Set the color of the textbox to match the background color (white, in this case).

3. Convert the byte array returned from the ReportingService.Render method to a string.

4. Pick out the number of pages with:

reportText.Substring(reportText.LastIndexOf("***pages: ")+10, reportText.LastIndexOf("***")-reportText.LastIndexOf("***pages: ")-10)

Like I said, goofy, but it will have to do for now.|||

If you would like to see an even goofier workaround, with somewhat more flexibility and potential, you may want to read this thread:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1807270&SiteID=1

>L<

Friday, March 23, 2012

How to determine default values of a field during runtime

Hi, i am using the function below (visual basic 6) to determine several
properties of
each field in a recordset (SQL server) and all is working well. My
problem is that I
dont know how to find the default value of a field from the table. Does
anyone have
any code suggestions that would get me the default value
For Each F In rstProgressData.Fields
If F.Type <> adChapter Then
If F.Name <> "upsize_ts" Then
rstDest.AddNew
rstDest!Progress = F.Name
Select Case F.Type
Case adChar, adVarWChar, adVarChar
rstDest!ProgressFieldType = "String"
rstDest!ProgressFieldSize = F.DefinedSize
Case adBoolean
rstDest!ProgressFieldType = "Boolean"
Case adSmallInt, adUnsignedTinyInt, adInteger
rstDest!ProgressFieldType = "Integer"
Case adDecimal, adNumeric
rstDest!ProgressFieldType = "Decimal"
Case adDBTimeStamp
rstDest!ProgressFieldType = "DateTime"
Case 203
rstDest!ProgressFieldType = "Memo"
End Select
If (F.Attributes And adFldIsNullable) = adFldIsNullable Then
rstDest!ProgressFieldNullable = True
End If
rstDest.Update
End If
End If
Next FThats hard to see where your recordset is based on if you don=B4t send
the query with you, but otherwise the information can be queried
through the INFORMATION_SCHEMA Views:
Select Column_default from INFORMATION_SCHEMA.COLUMNS
Where table_name =3D '<SomeTable>'
HTH, Jens Suessmeyer.|||The code has to be generic so that it can deal with any sql statement.
As above for any query I can get the field size, type, name & if its
nullable, I just need to find out what syntax to use to get the default
value e.g F.Type gives me type. F has been defined as an ADODB.Field.sql

Monday, March 12, 2012

How to Derive Parameters in Ad Hoc SELECT statements

Hi,

If I have ad hoc SQL statements created by users, which could be parameterized, how could I derive the parmeters at runtime. I cannot use CommandBuilder.DeriveParameters() as that is for StoredProcedures only.

Just use Split on the SQL string? Or is there a better way, such as a third-party .Net Component?

Thanks

John

We need more input on your problem. What does it mean that the users are creating the SQL Strings on their own, how does one look like ?

Jens K. Suessmeyer.

http://www.sqlserver2005.de
--|||

Hi,

The User's created SQL could be anything (they are writing a report!), but here is a trivial example

SELECT CustomerID, CustomerName FROM Customers WHERE CustomerID = @.CustomerID

Clearly, I have to Pop up a Window to the User for them to supply the actual run time value for @.CustomerID. Just like MS Access or the VS2005's Dataset Designer's Query Builder. Once I have the values I can populate Parameters Collection.

I was hoping someone would have some advise over Parsing SQL strings.

Thanks

John

|||

Best thing would be to regex the string and search for the matches within the string.

Jens K.

|||

Hi,

I've been looking at the General SQL Parser component, and it looks like I can simply get to the Field, Parameter pairs using this. Product is easily found, just do a Web search.

But, out of interests, Jens. Do you have contacts within the Microsoft Dev teams to find out how they do it in VS2005's Dataset Designer's Query Builder and Management Studio's Query Designer?

Rgds

John