Eliminates Duplicates - duplicates

I am using this expression definition in IBM Cognos Report studio 11, and they gives me duplicates values.
I want to modify to eliminates the duplicates (I have an unique field call Account Number).
This is the expression definition:
CASE WHEN ( [GL Application Master Monthly].[GL Application Master Monthly].[Current Interest Rate] > 0 and [GL Application Master Monthly].[GL Application Master Monthly].[Current Interest Rate] <=3.75 and [GL Application Master Monthly].[GL Application Master Monthly].[GL Account Number] not in(1561162, 1590863, 1645463, 1698362, 1698664) ) THEN ([GL Application Master Monthly].[GL Application Master Monthly].[App Converted Yesterday Balance]) END

Related

TFS reports finds wrong project after rename

The problem is that alle the reports for a given project is now looking at a wrong team project.
In the standard reports the following query is used to determine the project:
SELECT TOP 1 p.ProjectNodeGUID, p.ProjectNodeName FROM
(
SELECT ProjectNodeGUID, ProjectNodeName, 1 AS RowRank FROM GetProjectNodeInfoFromReportFolder(#ReportPath)
UNION
SELECT '00000000-0000-0000-0000-000000000000' AS ProjectNodeGUID, 'missing' AS ProjectNodeName, 0 AS RowRank
) p ORDER BY p.RowRank DESC
But it does not return the correct one.
What has happened is that I renamed a project from A to A.Old and created a new project called A.
Looking at the report server, there is no folder called A.Old, only A but that actually points to A.Old.
Any idea of how to fix that?
If you are connecting to the Warehouse for TFS then you will need to run a rebuild of the Warehouse to have this change passed through. This is true for Project Renames, Deletes, and Collection detach/attach.
This should have been displayed in the warning message when you did the rename.
Running a rebuild from the admin console will fix this...

Register custom audit events for billing

We are running a custom app on Invantive Data Access Point which adds business functionality to Exact Online. For billing purposes, we would like to somehow register actual use of the software as defined in business terms instead of memory used, CPU, SQL statements executed, etc.
We do not yet have custom tables and I would like to keep it that way, so the whole state is kept in memory and in Exact Online only. So "insert into mytable#sqlserver..." is not an option. Neither does Exact Online offer the possibility to create custom tables as with Salesforce.
How can we somehow register billable events, such as "Performed an upload of 8 bank transactions" under this condition?
For billing purposes, you can lift along on the Customer Service infrastructure, which is similar to functionality offered by AWS or Apple for this purpose in their eco system. The "table" which stores the billing events like a Call Detail Record of a PBX is managed by Customer Service infrastructure.
There are two options:
Your apps use the default audit and license event registrations like "User logged on", "First use of partition #xyz", etc. each with a specific message code like 'itgenlic125'.
Your apps define their own event types like "Performed an upload of bank transactions", with a message code 'mybillingmessagecode123' and the number '8' as quantity in the natural key.
The first option is automatically and always done. These data is also used to manage resource consumption and detect runaways.
The second option is best done using Invantive SQL with the data dictionary table "auditevents". All records inserted into auditevents are automatically asynchronously forwarded to Customer Service. To see the current register audit events since start of application:
select *
from auditevents#datadictionary
where:
occurrence_date: when it happened.
logging_level: always "Audit".
message_code: code identifying the type of event.
data_container_d: ID of the data container, used with distributed SQL transactions.
partition: partition within the data container for platforms such as Exact Online or Microsoft SQL Server which store multiple databases under one customer/instance.
session_id: ID of the session.
user_message: actual text.
last_nk: last used natural key
application_name: name of the appplication.
application_user: user as known to the application.
gui_action: action within the GUI.
And some auditing and licensing information fields.
To register a custom event:
insert into auditevents#datadictionary select * from auditevents#datadictionary
Only some fields can be provided; the rest are automatically determined:
message_code
user_message
last_natural_key
application_name
application_user
gui_action
gui_module
partition
provider_name
reference_key
reference_table_code
session_id
To receive the billing events yourself from the infrastructure, you will need to access the Customer Service APIs or have them automatically forwarded to mail, Slack, RocketChat or Mattermost channel.
A sample SQL:
insert into auditevents#datadictionary
( message_code
, user_message
, last_natural_key
, application_name
, gui_action
, gui_module
, reference_key
, reference_table_code
, partition
)
select 'xxmycode001' message_code
, 'Processed PayPal payments in Exact Online for ' || divisionlabel user_message
, 'today' last_natural_key
, 'PayPalProcessor' application_name
, 'xx-my-paypal-processor-step-2' gui_action
, 'xx-my-payal-processor' gui_module
, clr_id reference_key
, 'clr' reference_table_code
, division partition
from settings#inmemorystorage

SSRS 2016 Report Emails across time zones

I'm using SSRS 2016 and have a number of users that will need to receive an emailed report by 11am respective to the users local time.
What's the best practice for doing this?
My initial thought was to just create different Active Directory distribution lists for each time zone and add the users accordingly...then create multiple schedules for each report and adjust the time of the report send time relative to the when the reports were needs for distribution list.
As an example, the SQL server is on central time while Eastern and Central time employees need a report by 11am local time. - Create an email schedule to send report to eastern time employees at 10am (server time) and again at 11am for the central time employees.
Is there a better way to do this?
Your approach is exactly what we are doing. The SQL Server instance is in the Central time zone, and we have users around the world. Each group maintains a mailing list, and manually does arithmetic when creating a report subscription. Interestingly enough, SSRS adjusts to local user's language (Le rapport hebdomadaire #ReportName a été exécuté à #ExecutionTime instead of #ReportName was executed at #ExecutionTime for the default subject), but offers nothing to help with time zones.
If you have an enterprise edition of SQL Server, you could use data driven report subscriptions. Given the big increase in cost between standard and enterprise editions, I doubt this one feature justifies the cost.
The other solution requires things outside of SSRS, but it can be handy. If you have other scheduling tools running in the various locations, they could run a PowerShell script to trigger the subscription. You could also use this approach to run reports when data is loaded, for example.
PowerShell script to list subscriptions and their IDs:
$server = 'http://server.company.com/reportserver'
$site = '/'
$rs2010 = New-WebServiceProxy -Uri "$server/ReportService2010.asmx" -Namespace SSRS.ReportingService2010 -UseDefaultCredential
$subscriptions = $rs2010.ListSubscriptions($site)
$subscriptions | Sort-Object -property path,owner,SubscriptionID -Unique | select Path, Owner, SubscriptionID
Powershell script to trigger subscription:
# Given an SSRS URL and a subscription ID, trigger the subscription.
$server = 'http://server.company.com/reportserver'
$subscriptionid = "55477447-b0b0-433c-a75f-08ad0b6d18bd"
$rs2010 = New-WebServiceProxy -Uri "$server/ReportService2010.asmx" -Namespace SSRS.ReportingService2010 -UseDefaultCredential ;
$rs2010.FireEvent("TimedSubscription",$subscriptionid,$null)

Get files for deployed Reports

Is it possible to get the files for a deployed reports ON SSRS 2005?
On of our developers deployed them to the Reporting Server, but didn't commited his changes to SVN. Now we are in an inconsistent state and we also can't find the files he created.
In Report Manager (usually the URL ends with /Reports or /Reports_instanceName ) You can look at the details of reports. The Edit button will allow you to download the .rdl definition files.
From
http://msdn.microsoft.com/en-us/library/ms156032(v=sql.90).aspx
In the Report Definition section, click Edit to extract a copy of the report definition. Modifications that you make locally to the report definition are not saved on the report server.
(I should have also noted, the interface and the button name change in SSRS 2008, so these instructions are specific to SSRS 2005.)
use ReportServer
go
create view vwReportDataSet_SharedDataSet_Mapping
as
select ds.itemid, ds.name as Report_DataSource,
cat.name as Shared_DataSource
from datasets ds
inner join catalog cat on ds.linkid = cat.itemid
go
create view vwSharedDataset_Usage
as
select cat.path,
cat.name,
cat.type,
ds.Report_DataSource,
ds.Shared_DataSource
from
catalog cat
left join vwReportDataSet_SharedDataSet_Mapping ds
on cat.itemid = ds.itemid
This SQL gives you your report dataset usage.
select * from vwSharedDataset_Usage
where type = 2
and path like '/SIT/%'
and name in ('Report1','Report2')

SSRS error handling

Is there a way to customize how SSRS reports its log? I would like SSRS to report subscription errors to a database, is there a way to do this?
Thank You
SSRS already logs the status of its subscriptions to the report server on the server that your instance of SSRS is running on. You could run the following query on your ReportServer and it will show you the last run status of the Subscription.
I've used this query in conjunction with an SSIS package to copy the report server database to create a report that sends out to various people telling them of the status of the subscriptions that exist on the report server
USE ReportServer
SELECT
CatalogParent.Name ParentName, --Folder names
Catalog.Name ReportName, --Actual rpt name
ReportCreatedByUsers.UserName ReportCreatedByUserName, --first deployed by
Catalog.CreationDate ReportCreationDate, --deployed on
ReportModifiedByUsers.UserName ReportModifiedByUserName, --last modification by
Catalog.ModifiedDate ReportModifiedDate,
CountExecution.CountStart TotalExecutions, --total number of executions since deployment
ExecutionLog.InstanceName LastExecutedInstanceName, --server excuted on
ExecutionLog.UserName LastExecutedUserName, --user name
ExecutionLog.Format LastExecutedFormat, --render format
ExecutionLog.TimeStart LastExecutedTimeStart, --start time
ExecutionLog.TimeEnd LastExecutedTimeEnd, --end time
-- These times need work, not always what you expect
ExecutionLog.TimeDataRetrieval LastExecutedTimeDataRetrieval,
ExecutionLog.TimeProcessing LastExecutedTimeProcessing,
ExecutionLog.TimeRendering LastExecutedTimeRendering,
-- end
ExecutionLog.Status LastExecutedStatus, --status of the report processing (not subscription)
ExecutionLog.ByteCount LastExecutedByteCount, -- bytes returned (just because i can)
ExecutionLog.[RowCount] LastExecutedRowCount,
SubscriptionOwner.UserName SubscriptionOwnerUserName, --subscription creator
SubscriptionModifiedByUsers.UserName SubscriptionModifiedByUserName, --subscription modifier
Subscriptions.ModifiedDate SubscriptionModifiedDate, --latest modification date
Subscriptions.Description SubscriptionDescription, --what the subscription does
Subscriptions.LastStatus SubscriptionLastStatus,
Subscriptions.LastRunTime SubscriptionLastRunTime --last time the subscription ran. this may be different to the last
-- execution time especially if report is set to cache
FROM
dbo.Catalog JOIN dbo.Catalog CatalogParent --rs catalog (all things deployed to rs)
ON Catalog.ParentID = CatalogParent.ItemID
JOIN dbo.Users ReportCreatedByUsers --all rs users
ON Catalog.CreatedByID = ReportCreatedByUsers.UserID
JOIN dbo.Users ReportModifiedByUsers
ON Catalog.ModifiedByID = ReportModifiedByUsers.UserID
LEFT JOIN (SELECT
ReportID,
MAX(TimeStart) LastTimeStart
FROM
dbo.ExecutionLog --self explanatory
GROUP BY
ReportID
) LatestExecution --gets the latest execution date rather than having a list longer than life
ON Catalog.ItemID = LatestExecution.ReportID
LEFT JOIN (SELECT
ReportID,
COUNT(TimeStart) CountStart
FROM
dbo.ExecutionLog
GROUP BY
ReportID
) CountExecution -- gets the number of executions (because we can)
ON Catalog.ItemID = CountExecution.ReportID
LEFT JOIN dbo.ExecutionLog
ON LatestExecution.ReportID = ExecutionLog.ReportID
AND LatestExecution.LastTimeStart = ExecutionLog.TimeStart
LEFT JOIN dbo.Subscriptions --subscription details
ON Catalog.ItemID = Subscriptions.Report_OID
LEFT JOIN dbo.Users SubscriptionOwner --user info
ON Subscriptions.OwnerID = SubscriptionOwner.UserID
LEFT JOIN dbo.Users SubscriptionModifiedByUsers --user info
ON Subscriptions.OwnerID = SubscriptionModifiedByUsers.UserID
ORDER BY
CatalogParent.Name,
Catalog.Name
Logging and reporting on the stack trace as in the LogFiles on the server is a little less straightforward!
SSRS have a default logging mechanism on SQL server instance being used with SSRS report. you can find the log file on the following path.
C:\Program Files\Microsoft SQL Server\MSRS11.MSSQLSERVER\Reporting Services\LogFiles
Top most file have all the reporting server logs, open that file and navigate to the end to view most recent logs.