MS SSRS

Session Timeout Reporting Service ändern

Daniel Snellen

In einem Projekt mit sehr sensiblen Daten und einem externen Zugriff auf die Reports, kam die Anforderung auf den Session Timeout anzupassen um die Datensicherheit zu erhöhen.

Der Session Timeout im Reporting Server ist nach der Installation 600 Sec = 10 Min.

Diesen kann man jedoch ändern.

Als erstes erstellt man die Datei sessionTimeout.rss mit folgendem Inhalt

Public Sub Main()
    Dim props() as [Property]
    props = new [Property] () { new [Property]()}

    props(0).Name = "SessionTimeout"
    props(0).Value = timeout

    rs.SetSystemProperties(props)
End Sub

 

Als nächstes führt man folgenden Befehl aus dem Verzeichnis aus, in dem die sessionTimeout.rss gespeichert wurde.

rs -i sessionTimeout.rss -s http://localhost/reportserver -v timeout="300"

Die Angabe des Timeoutwertes ist in Sekunden.

RS.exe ist das Scripting Tool für den Reporting Service nähere Infos HIER

  • Share/Bookmark

Firefox und Windows integrierte Anmeldung

Daniel Snellen

Wenn man mit dem Firefox auf einen Webserver zugreifen möchte, welcher mit Windows Integrierter Anmeldung arbeitet, wird man zur Eingabe des Benutzernamen und Passwort aufgefordert.

Sobald mit Reporting Service und Datenquellen mit Windows Integrierter Authentifizierung gearbeitet werden soll, sind diese Einstellungen notwendig.

Man kann den Firefox so konfigurieren, das er den Angemeldeten Domain Benutzer an die Webseite übergibt.

1. In der Adresszeile des Firefox muss about:config eingegeben werden.

2. Es erscheint als erstes eine Warnung in dieser wird man auf mögliche Risiken hingewiesen
image

3. Es müssen zwei Parameter angepasst werden.

  • network.negotiate-auth.delegation-uris
  • network.negotiate-auth.trustes-uris

Durch einen Doppelklick auf den jeweiligen Parameter öffnet sich das Eingabefenster.
Hier muss die URL des Webservers eingetragen werden.
image

Durch Komma getrennt können auch mehrere Webserver eingetragen werden.

Der Eintrag sollte bei beiden Parametern identisch sein.

  • Share/Bookmark

ClickOnce Anwendungen im Firefox

Daniel Snellen

Um eine sogenannte ClickOnce Anwendungen im Firefox zu starten wird ein Addon benötigt.

Eine ClickOnce Anwendungen ist z.B. der Report Builder (2.0 und 3.0), dabei kann man die Anwendung aus der Webseite heraus starten, ohne diese vorher installiert zu haben.

Das nach bisherigen Erkenntnissen beste Addon wurde von Microsoft bereitgestellt.

https://addons.mozilla.org/de/firefox/addon/9449

Addon Installieren

Zum installieren des Addons öffnet man den Firefox und ruft dort die URL des Addon auf.
https://addons.mozilla.org/de/firefox/addon/9449

image

Als nächstes muss die Schaltfläche Continue to Download betätigt werden.

Nun noch die Lizenzbedingungen bestätigen.

image
und die Installation starten.

Abschließend muss der Firefox neugestartet werden
image

Als Systemvoraussetzung setzt das Addon .NET Framework 3.5 SP1 voraus.
Leider lässt es sich aber auch Installieren wenn die Voraussetzung nicht erfüllt ist, es erscheint auch keine Fehlermeldung.

  • Share/Bookmark

Alternierende Hintergrundfarbe für Detail- und Gruppenzeilen

Arno Cebulla

Alternierende Hintergrundfarben für Detailzeilen lassen sich mit folgendem Ausdruck in die Hintergrund-Eigenschaft der Zeile darstellen:

=IIF(RowNumber(NOTHING) Mod 2,"WhiteSmoke","Transparent")
 

Auch Gruppen lassen sich mit wechselnden Hintergrundfarben darstellen. Hierfür wird der Ausdruck

=IIF(RunningValue(<Gruppenfeld>,CountDistinct,Nothing) MOD 2,"Gainsboro","Silver")
 

in der Hintergrundeigenschaft des Gruppenfeldes gesetzt. <Gruppenfeld> wird dann durch die entsprechende Feldbezeichnung der Gruppe ersetzt.

Beispiel: Eigenschaft Hintergrund in Subcategory:

=IIF(RunningValue(Fields!Subcategory.Value,CountDistinct,Nothing) MOD 2,"Gainsboro","Silver")

Eigenschaft Hintergrund in Product: sh. oben

Ergebnis:

 

Matrix mit alternierendem Hintergrund für Subcategory (Gruppe) und Product (Details)

  • Share/Bookmark

Creating your own SSRS map using Visio

Hilmar Buchta

SQL Server 2008 R2

In my last post I mentioned creating a map by yourself as one possible use case for the Visio-To-SQL-Server geo data export. In this post I will give you some details how this can be done.

First, we need some kind of a map. For this post I’m using a map of Europe which I found as a PNG file at Wikipedia: http://upload.wikimedia.org/wikipedia/commons/6/64/Europe_capitals_map_de.png

The image is then inserted into a blank Visio file. You should make it as large as possible (use landscape orientation). Then, we’re ready to begin. We’re using the freeform tool to follow the coast lines. In my case I’m creating a map for UK and Ireland. Note that you can interrupt the process at any time and continue using the freeform tool later. Also, don’t bother too much with the details by now.

image 

Finally, the curve needs to be closed. Visio shows this by actually filling the area using the default fill color:

image

If you missed the start point, it’s not a problem as you can correct every single point of your curve and also add new control points using the pencil tool. Before doing so, you should add your recently created shape to a new Visio layer and set the transparency of the layer to an appropriate value (e.g. 20%) so you can see both, the sheet and the map image. Now you should work at a higher zoom level to detail out the border lines as shown below. Note that you can CTRL+click any control point to see and modify the curve control.

image

Your final result may look somewhat like this

image

Please note that we didn’t care about the country borders in this step (as you can see from Ireland) but just about the coastlines.

Next we’re going to model the border between UK and Ireland. Therefore we need to create some kind of tool shape in order to cut out the corresponding part. To make our work easier, we’re going to hide our GEO layer, so we’re only seeing the map now. We then draw the shape of the border line. Please note that the shape is extended to the sea side as we don’t want to risk that some parts of the underlying shape are not cut out.

image

The next steps are a little bit confusing if you perform them for the first time. Here is what we are going to do:

  1. Make the hidden GEO layer visible again.
  2. We can now see all of our drawn shapes including the tool shape. As the tool shape was create at a later time it is in front of our original shapes.
  3. Mark the basic shape for Ireland first and then the tool shape while pressing CTRL. It is important to do it this way.
  4. Copy both shapes to the clipboard for later use
  5. Do a shape substract operation. Depending on your version of Excel it’s a menu entry at shape>operation>subtract or maybe you have to consult the help file
  6. This results in Ireland having the topmost part cut out
  7. Paste the two shapes from step 4 back into the sheet
  8. Do a shape intersect operation
  9. Move the resulting shape back into position (use the SHIFT key together with the arrow keys to position the shape properly)

 

The result should look somewhat like this:

image

Next we’re going to group all the shapes for UK (don’t forget the islands) together into one shape. We set the text for this shape to “United Kingdom”. Ireland consists of a single shape in my example so we just have to name it accordingly. image

These shapes are already what we need for our lines layer in the SSRS map. The lines layer will only be visible as border lines and will be on top of our map. To make this happen, we mark both shapes and create a copy (copy+paste), then move the copy to the same location as the original shapes. While the copied shapes are still marked we add them to a new layer called LINES. We can then hide the LINES layer as it would only be confusing for our next steps.

Now, by using exactly the same tools as above, we’re going to create the sales regions North, Middle and South. If you have problems with the intersection and the subtract tools, you may need to un-group your shapes before using one of the combine-tools. In my example, the sales regions do not match the country borders. I therefore first combine the two shapes on the island of Ireland together to one shape. Next I’m cutting the whole map into three pieces. In the next screenshot I colored the pieces to make it more clear:

image

All shapes with the same color are grouped together into a single shape. We name the shape according to our sales regions: North, Middle and South. Now we’re almost finished. We now move all the shapes for our sales regions to a new layer called INTERACTIVE and remove all layers except INTERACTIVE and LINES. We can now set both layers to visible again. Maybe some shapes from the INTERACTIVE layer have to be pushed into the background but then the final result should look like this:

image

Note that the sales regions do not match the border in Ireland.

Using the same macro as described in my last blog post I’m exporting the Visio data into a SQL table called UK_Map. In this case we end up with two layers (no layer 0 as we don’t have any background polygons as the park house in my last post):

Layer 1
(interactive layer)
Layer 2
(line overlay)
image image

 

In order to have the three different sales region colored by their sales we have to provide some sales data. In this case, I’m going the easy way and provide only the following three lines:

SalesRegion    SalesValue
North    400
Middle    900
South    700

 

So this is how the final report looks like. Note that the country borders do not match the sales region but are still visible (lines layer). 

image

Of course we could also add some major cities or more details but for today, I think we did enough.

  • Share/Bookmark

Druckansicht mit Kopf- und Fußzeile bei Reports im Sharepoint

Arno Cebulla

Bei der Anzeige im Sharepoint sind Kopf- und Fußzeile in einem Report oft unerwünscht, da z.B. das Logo bereits auf der Sharepointseite angezegit wird,. Beim Ausdruck sollen die Zeilen dann wieder angezeigt werden. Hier ein Workaround:

 1. Ein Report „Sub1“ wird ohne Header und Footer, incl. Parameter für die Ansicht im Sharepoint erstellt.

 2. Dem Report wird ein Textfeld „Druckansicht“ hinzugefügt:

 

 3.  Ein Parameter“@Print“ mit Datentyp Integer wird erstellt.

 4. In den Properties der Textbox wird unter „Visibility“ der Punkt „Show or hide based on an expression“ ausgewählt und folgende Expression eingegeben:

   =Parameters!Print.Value <> 0

 5. Nun wird ein neuer Report mit Header und Footer erstellt. Dieser „Master“-Report muss die gleichen Parameter wie der o.g. Report enthalten.

 6. Dem Master-Report wird eine Matrix hinzugefügt. Die Zeile für die Spaltenüberschriften sowie die Spalte für die Zeilenbeschriftung wird gelöscht. In das verbleibende

     Feld „Data“ wird nun ein Subreport eingefügt.

 7. Als Subreport wird „Sub1“ ausgewählt. Die Parameter werden an den Report übergeben. Der Parameter „@Print“ erhält den Wert 1.

 8. Der Master-Report wird gespeichert.

 9. In der Designansicht von „Sub1“ werden die Properties der Textbox „Druckansicht“ ausgewählt.

10. Unter „Action“ wird der Punkt „Go to Report“ aktiviert. Als Report wird der „Master“-Report  ausgewählt. Die Parameter werden hinzugefügt.

 

Der Report „Sub1“ kann nun gestartet werden. Bei Klick auf „Druckansicht“ wird der Report mit Header und Footer angezeigt.

 

Sharepoint-Ansicht

 

Druckansicht

  • Share/Bookmark

Microsoft® SQL Server® 2008 R2 Best Practices Analyzer verfügbar

Daniel Snellen

Seit dem 18.06.2010 steht jetzt auch der SQL Server 2008 R2 Best Practices Analyzer (BPA) zum Download auf der Microsoft Webseite bereit.

http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=0fd439d7-4bff-4df7-a52f-9a1be8725591

Der SQL Server 2008 R2 BPA ist ein Diagnosetool, welches den SQL Server anhand von Best Practices analysiert und einen Bericht ausgibt, in dem auf mögliche Konfigurationsfehlern oder Fehlenden Updates hinweist.

Der BPA gibt auch genaue Hinweise wie die möglichen Probleme gelöst werden können.

  • Share/Bookmark

Using Visio and SSRS Map Reports for Store Layouts etc.

Hilmar Buchta

SQL Server 2008 R2

My last posts about Reporting Services in SQL Server 2008R2 covered the new support for maps and how to import and work with ESRI shape data.

However, those new features of Reporting Services are not limited to geographical map data (countries, regions etc.) but can be used to visualize almost any kind of polygonal data. For example, there are very interesting posts showing how to actually draw a heat map using SSRS’s map technology. If you’re interested, I suggest taking a look at one of these posts:

 

Being able to show different kind of geometrical data also makes it interesting to use this feature for store layouts. Basically my idea was this:

  • Use Microsoft Visio as an editor for the store layout
  • Export all sheets of the Visio file to a data base table
  • Use Reporting Services to visualize the visio shape information and link some parts of the graphic to an analytical data set for shading

 

For my example, I created a layout of a park house. Each slot is to be colored depending on the number of parking hours they were occupied during a selected period. Here is the final SSRS report:

image

And here is the corresponding Visio file I made for this purpose:

image

The main reasons for me to explore this approach instead of simply using Visio services (included in Sharepoint) are:

  1. Purely data driven approach – all layout data is stored as spatial data in a SQL Server table
  2. All layouts (for example several stores with different layers) could by managed in a single Visio file (or a few Visio files)
  3. The interactivity (for example link action to another drawing) and the mapping to the data can be highly automated.
  4. It is very easy to create a report that checks, if shapes are missing (data available, but no corresponding shape in the geometry table).
  5. Suitable for users without access to Sharepoint or without the Sharepoint Enterprise CAL

 

The approach described here is suitable for

  • Any kind of store layouts (for example: mapping from product sales to the area in the store)
  • Custom geographical maps (it’s quite easy to load a bitmap into Visio and then create some polygons on top of it to get the proper shapes)
  • Visualization of technical systems or processes
  • Strategy maps
  • Etc.

 

During the development I had some issue to solve, so this post is to describe my general approach. At first, I was quite surprised to find how difficult it is to get the shape data out of Visio. You could export the Visio file to DXF format and use one of the converters from DXF to ESRI you will find in the web. But this seems like a complicated process to me. So for my example, I wrote a Visio macro to actually perform the export. My destination table looks like this:

Field name Description Sample Value
sheetid Number of the sheet tab in the Visio file 1
sheetname Name of the sheet in the Visio file Level1
layer Corresponding layer for the map (see below) 1
shapeid Number of the shape (internal id by Visio) 47
shapename Name of the shape. For the interactive layer I used this field as the link to the analytical data set. For example, 01_01.112 stands for park house 1, level 1, slot 112 01_01.112
shapetext Text of the shape 112
data1 extra Visio data (field 1)
Used as a link to the next layer of the park house
Level2
data2 extra Visio data (field 2)  
data3 extra Visio data (field 3)  
fillcolor Background color for the shape #ff0000
linecolor Line color for the border of the shape #000000
linewidth Line width for the border of the shape 0.75
linestyle Line style Solid
fontname Font name Calibri
fontsize Font size 12
fontcolor Color for the text #000000
geom Data of type geometry  

 

In order to display the map on an SSRS report, the map tool requires to set up a layer. For each layer you are relatively free to display shapes. However, there are some restrictions:

  • Each layer must contain either polygon or line or point shapes. No mixture is allowed
  • Each layer may be set up to acquire its shading color either from an analytical data set or from expressions (that can link to existing data of course)

 

In order to set up the layers for my map, I used the following layout:

Layer Description
0 Bottom layer (Background) containing only polygons. No interactive data elements. All shape properties (like background color for example) are taken from the data set described above
1 Interactive layer. This layer also contains only polygons. The layer is configured using an analytical data set to perform the shading of the elements
2 Non-interactive layer of lines. As described above, the lines in the drawing must not be mixed with the polygons from layer 0. However, putting those lines on top of the interactive layer 1 makes it possible to show for example regional borders on top of sales areas (interactive coloring) that are not restricted to a single region.
3 Non-interactive layer of points (I didn’t use this in my example)

 

In Visio I’m using the Layer functionality to mark all the interactive elements (for layer 1), so this is how my drawing looks like in Visio when hiding this layer:

image

But how about the round shapes? How are they converted to a polygon. Although I was concerned a little, Visio does this job pretty well. In the following extract of the code, patchcount is a variable to loop through each path contained in the shape (oShape) and adblXYPoints is simply an array of numeric values. The 0.01 gives the precision Visio uses to transform the curves into polygons.

oShape.Paths(pathcount).Points 0.01, adblXYPoints

For layer 0, all shape properties are linked to the underlying data set. For example, this is how the font tab is configured:

image

You can clearly see that field bindings or expressions are used to configure the properties. For example, the expression for the font size looks like this:

=Fields!fontsize.Value & "pt"

The distribution of the spatial data to the layers is done by using one single data set together with the filters in the layer’s data properties. The the background layer 0, the filter is defined as follows:

image

However, I had some problems with the filter when using the analytical data, so I created a separate data set for the interactive layer.

Finally, the export from Visio to my geometry table works fine although not all of Visio’s graphical features can be rendered by a Reporting Services map. I’m still surprised how good the rendering actually looks and how easy it is, to link it with some analytical data to get a nice visualization.

  • Share/Bookmark

Reporting Service Warmup

Daniel Snellen

Der erste Aufruf eines Reports vom Reporting Service dauert immer recht lange.
Um dieses Verhalten dem Benutzer gegenüber auszublenden, kann man einen sogenannte Warmup durchführen.
Es gibt verschiedenste Wege ein solches Warmup durchzuführen, ich werde hier einen Weg mittels des Tools WGET beschreiben. 
GNU WGET ist ein kostenloses Komandozeilenprogramm zum Herunterladen von Dateien aus dem Internet. >Download<

Wir nutzen Wget zum beleben des Reporting Service, in dem wir die Startseite das Reportmanagers aufrufen, besser gesagt wir laden die Startseite mittels WEGT herunter.
Folgender Befehl muss ausgeführt werden.

wget  –http-user=BEUTZERNAME –http-password=PASSWORT http://SERVERNAME/Reports/ –delete-after


http://SERVERNAME/Reports“
Dieser Abschnitt gibt die URL das Report Managers an und muss jeweils noch angepasst werden.

“ –http-user=BENUTZERNAME“
Dieser Abschnitt gibt den Benutzer an mit dem sich WEGT am Report Manager anmeldet.
Bei Domain Benutzer muss DOMAIN\BENUTZERNAME angeben werden.

“ –http-password=PASSWORT“
Dieser Abschnitt gibt das Passwort des Benutzers  an.
Da der Benutzername und das Passwort hier im Klartexte gespeichert werden, sollte hier ein Benutzerverwendet werden, der nur die Startseite des Reporting Service aufrufen kann und sonst keine Reports sieht.
Des Weiteren sollte man darauf achten das Passwort des Benutzers nicht abläuft, weil dann wget keinen Zugriff auf den Reportmanager mehr hat und das Script angepasst werden muss.

“ –delete-after“
Dieser Abschnitt gibt an das die heruntergeladenen Dateien abschließend wieder gelöscht werden, damit das lokale Verzeichnis nicht überläuft.

Wenn der Reporting Service über HTTPS erreichbar ist und es sich um ein privates SSL Zertifikat handelt, kann es sein das Wget das Zertifikat nicht überprüfen kann und abbricht.
In diesem Fall muss dann noch der Parameter “ –no-check-certificate” hinzugefügt werden.

Der gesamte Wget Befehl sollte in einer Batchdatei gespeichert und einem geplanten Task eingebunden werden.
Dieser Task sollte dann so geplant werden, dass er z.B. jeden Morgen um 7Uhr läuft.

Achtung vor den Befehlen kommen immer 2 Minuszeichen!! Leider wird das nicht immer korrekt dargestellt.

Recycle Time

In der rsreportserver.config wird die Recycle Time definiert. Diese gibt an nach welcher Laufzeit der Webdienst des RS zurückgesetzt wird.
Standard ist hier 720, die Angabe ist in Minuten.

<RecycleTime>720</RecycleTime>

Dieses Zeitangabe sollten man bei der Planung des Task beachten und gegebenen Falls anpassen.

  • Share/Bookmark

German map spatial data for PLZ (postal code) regions

Hilmar Buchta

SQL Server 2008 R2

As a response on my last post I was asked if this is also possible with postal code regions (PLZ). It’s more difficult to find free, usable map data for this purpose. But with the help of a popular search engine I came up with the following link: http://arnulf.us/PLZ

Here you can get the ESRI shape file for the German postal code regions. You can load this data in exactly the same way as shown in my last post.

This is how the map looks after importing it into a SQL Server table (displayed in SQL Spatial Query Visualizer):

image

As you can see, the map is very detailed. It would be perfect, if we could add some layer of aggregation. For the German postal code, it would be a good idea to aggregate them using the first two digits, so that for example, the aggregated level of 40 includes all the postal codes like 40221 (the postal code of my company’s headquarters).

In order to join the shapes of the postal code areas we can use the SQL Server 2008 spatial functions. Therefore I loaded the data provided by the link above into a table post_pl. The following T-SQL script then creates a new table with the name post_pl2 containing the shape data for the aggregated areas:

IF EXISTS(SELECT name FROM sys.tables WHERE name = ‘post_pl2′) begin drop table post_pl2 end

create table post_pl2 (
PLZ2 nvarchar(2),
geom geometry
)

DECLARE @pl_group nvarchar(2)
DECLARE @t geometry = ‘GEOMETRYCOLLECTION EMPTY’;

DECLARE my_cursor CURSOR FOR
SELECT distinct left(PLZ99,2) FROM post_pl

OPEN my_cursor

FETCH NEXT FROM my_cursor INTO @PL_Group

WHILE @@FETCH_STATUS = 0
BEGIN
    set @t=’GEOMETRYCOLLECTION EMPTY’
    select @t= @t.STUnion(geom.MakeValid()) from dbo.post_pl 
      
where PLZ99 like @pl_group+’%’

    insert into post_pl2(PLZ2,geom) values(@pl_group, @t.BufferWithTolerance(0.001,0.1,0))

    FETCH NEXT FROM my_cursor
    INTO @PL_Group
END

CLOSE my_cursor
DEALLOCATE my_cursor

The query takes some time to execute (about a minute on my virtual development environment), so be patient. I’m using BufferWithTolerance here to smooth the results, because the postal code areas do not fit perfectly. The resulting spatial data is now joined together at postal code region level (2 digits):

image

From here you can get a more detailed view by filtering on a single postal code region (in my example, I’m using the region 40xxx):

image

Instead of the T-SQL code from above you could also use the .Net stored-procedure from Craig Dunn’s post. This makes it very easy to build the aggregate because it provides a “normal” aggregation function UnionAggregate that is capable of aggregating the data type geometry. If your spatial data is stored in a field of the type geography instead, you will definitely want to take a look at the SQL Server Spatial Tools at Codeplex. Here you can find the corresponding GeographyUnionAggregate for the geography data type.

You could also combine the spatial information from this post with the shapes from my last post to allow a drilldown like Country, German state (Bundesland) and then postal code region and postal code.

  • Share/Bookmark

  • Kategorien

  • Copyright © ORAYLIS Blog. All rights reserved.