Início > BI, SSRS 2008 > CUSTOM CODE–SSRS 2008

CUSTOM CODE–SSRS 2008


CUSTOM CODE (debugged with Visual Studio 2008):

  • Can be Embed on the report or referenced as an external assembly;
  • Embedded code:
    • Written on the menu: Report -> Report Properties –> Code
    • Must be instance based.
    • Must be written in VB.NET.
    • Methods are available through the global Code member.
    • Methods cannot be called from multiple reports. They are stored in the report definition, so they are available in only the report that contains the methods.
    • Possible declarations:
      • Function GetStockColor
      • Public Function GetStockColor
      • Shared Function GetStockColor
      • Public shared Function GetStockColor
    • Add on properties of an object TextBox.Color.Expression. Accesed by:
      • =Code.GetStockColor(Fields!StockLevel.Value, Fields!SafeStockLevel.Value)
  • External assembly:
    • Can be written in VB or C# on .Net Framework 2.0
    • Creation Process:
      • On the AssemblyInfo.cs:
        • Add using System.Security;
        • Add [assembly: AllowPartiallyTrustedCallers()]
      • Copy the assembly to the GAC and to the SSRS folder
      • Reference the Assembly on the Project (Report properties -> References)
      • #Error means security permissions:
        • Create Permission Sets and Code Groups (UI saves to security.config)
        • Copy info from security.config to rssrvpolicy.config
    • Accessing:
      • Static methods are called directly from the class in the form
      • =Namespace.Class.Method()
      • =SSRSAssembly.MISAssembly.GetPercentageIncrease(par1,par2)
      • Cannot be called using an instance name

<CodeModules>
      <CodeModule>SSRSAssembly, Version=1.0.0.0, PublicKeyToken=93f1aed039a24637</CodeModule>
</CodeModules>

      • Instance methods:
        • =Code.Instance.Method()
        • =Code.MyInstance.GetPercentageIncrease2(10,15)
          • MyInstace is mapped to the class name
        • Cannot be called directly from the class.
      • Only public methods can be accessed in report expressions
      • Shared (static) methods are faster than instance methods

 

<Classes>
      <Class>
            <ClassName>SSRSAssembly.MISAssembly2</ClassName>
            <InstanceName>MyInstance</InstanceName>
     </Class>
</Classes>

 

image

About these ads
Categories: BI, SSRS 2008
  1. Ainda sem comentários.
  1. No trackbacks yet.

Deixar uma resposta

Preencha os seus detalhes abaixo ou clique num ícone para iniciar sessão:

WordPress.com Logo

Está a comentar usando a sua conta WordPress.com Log Out / Modificar )

Imagem do Twitter

Está a comentar usando a sua conta Twitter Log Out / Modificar )

Facebook photo

Está a comentar usando a sua conta Facebook Log Out / Modificar )

Google+ photo

Está a comentar usando a sua conta Google+ Log Out / Modificar )

Connecting to %s

Seguir

Get every new post delivered to your Inbox.

%d bloggers like this: