Dynamics NAV

Showing posts with label Reporting. Show all posts
Showing posts with label Reporting. Show all posts

Thursday, 12 March 2015

How can I Reset the page Number for each group in rdlc reports

Please follow the below steps to get the page n of m for each page
Step 1:  Make sure there's a textbox in the report which contains the group expression
Step 2:  Add shared variables to track the current group and page offset
 Shared offset as Integer
 Shared currentgroup as Object
Step 3:  Add a custom function to set the shared variables and retrieve the group page number
 Public Function GetGroupPageNumber(group as Object, pagenumber as Integer) as Object
  If Not (group = currentgroup)
   offset = pagenumber - 1
   currentgroup = group
  End If
  Return pagenumber - offset
 End Function
Step 4: Use the function in the page header or footer
 =Code.GetGroupPageNumber(ReportItems!Category.Value,Globals!PageNumber)
Note:  Because this uses static variables, if two people run the report at the exact same moment, there's a slim chance one will smash the other's variable state  (In SQL 2000, this could occasionally happen due to two users paginating through the same report at the same time, not just due to exactly simultaneous executions)  If you need to be 100% certain to avoid this, you can make each of the shared variables a hash table based on user ID (Globals!UserID).

Wednesday, 4 February 2015

NAV2009 Reporting Error

Sometimes the following error may occur while designing RDLC Report
     “The provided metadata is not valid”
This error can happen when the following conditions are true:
You are using Windows Vista and User Access Control (UAC) is turned on.

  • The executable file that runs the Visual Studio development environment (devenv.exe) is set to run as an administrator.
  • The executable file that runs the Classic client with Microsoft SQL Server (finsql.exe) is not set to run as an administrator.
  • To resolve this issue, either turn off UAC or set both finsql.exe and devenv.exe to run as an administrator.
To turn off UAC

  • In Control Panel, select User Accounts.
  • In User Accounts, click Turn User Account Control On or Off.
  • Clear the Use User Account Control (UAC) to help protect your computer check box.
  • To set a program to run as an administrator
  • Right-click the .exe file, and then select Properties.

In the Properties window, on the Compatibility tab, in the Privilege Level section, selectRun this program as an administrator.