Um blog sobre nada

Um conjunto de inutilidades que podem vir a ser úteis


Posted by Diego em Outubro 13, 2012

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

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

      • 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






Deixe uma Resposta

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

Logótipo da

Está a comentar usando a sua conta Terminar Sessão /  Alterar )

Google+ photo

Está a comentar usando a sua conta Google+ Terminar Sessão /  Alterar )

Imagem do Twitter

Está a comentar usando a sua conta Twitter Terminar Sessão /  Alterar )

Facebook photo

Está a comentar usando a sua conta Facebook Terminar Sessão /  Alterar )


Connecting to %s

%d bloggers like this: