Showing posts with label target. Show all posts
Showing posts with label target. Show all posts

Tuesday, March 6, 2012

"Cummilative Sum"

Hi all,

I've got a view with the following data: (Sample)

Class Date Month Year Day Target Actual Variance MName
====================================================================
DropBalling 01/07/2005 7 2005 1 165000 117850 -47150 July
DropBalling 02/07/2005 7 2005 2 165000 92550 -72450 July
DropBalling 03/07/2005 7 2005 3 165000 171900 6900 July
DropBalling 04/07/2005 7 2005 4 165000 66850 -98150 July
Lancing 01/07/2005 7 2005 1 90000 44100 -45900 July
Lancing 02/07/2005 7 2005 2 90000 129650 39650 July
Lancing 03/07/2005 7 2005 3 90000 85450 -4550 July
Lancing 04/07/2005 7 2005 90000
Plant 01/07/2005 7 2005 67000
Plant 02/07/2005 7 2005 2 67000 18150 -48850 July
Plant 03/07/2005 7 2005 3 67000 6150 -60850 July
Plant 04/07/2005 7 2005 67000

I want to create a chart, which looks like this: http://www.tjoppie.co.za/chart.jpg .. So what I'll have to do is "cummilate sum" everyday's targets and actuals. How can I do this?

Thanks
RudiI couldn't understand exactly what type of sums you want to generate. Below is an example of how cumulative sums are typically generated in SQL. The example users northwind table and you can adapt this technique to your needs:

select o1.OrderID, o1.ProductID, sum(o2.UnitPrice), sum(o2.Quantity), sum(o2.Discount)
from Northwind.."Order Details" as o1
join Northwind.."Order Details" as o2
on o1.ProductID = o2.ProductID and o2.OrderID <= o1.OrderID
where o1.ProductID = 9
group by o1.OrderID, o1.ProductID
|||Thanks,

That did the job. Smile

Saturday, February 25, 2012

"Class not registered" with RMO and x64 Windows

I have a small .net application that uses RMO to synchronize a merge subscription. Everything works fine when I build with platform target = "Any CPU" on both x86 and x64 systems, but I get a "Class not registered" error on my x64 system when the application is built with platform target = "x86". Incase you are wondering I have to run this code under x86 because it is actually going to distributed in a dll and called from an x86 application.

x64 System:

Microsoft Windows Server 2003 R2

Enterprise x64 Edition

Service Pack 1

Here is my code:

{
ServerConnection dbconn = new ServerConnection(publication_server);
dbconn.LoginSecure = true;
dbconn.Connect();

MergeSubscription subscription = new MergeSubscription();
subscription.ConnectionContext = dbconn;
subscription.DatabaseName = publication_db;
subscription.PublicationName = publication_name;
subscription.SubscriberName = subscription_server;
subscription.SubscriptionDBName = subscription_db;

if (!subscription.LoadProperties() || subscription.SubscriberSecurity == null)
throw new Exception("Unable to initialize the Synchronization");

MergeSynchronizationAgent agent = subscription.SynchronizationAgent;
agent.Synchronize();
}

The MergeSynchronizationAgent class is platform specific (it is just a thin wrapper around a pile of native code), so you would need to make sure that you have the x86 version of SQL Server installed on your x64 server if you compile your exe as x86.

-Raymond

|||

I would hate to install an x86 instance of SQL Server to solve this issue. Is there anything short of that I can do to get the appropriate files and registry keys on to an x64 system?

Thanks for your help.

|||

Sorry to disappoint you, but there really isn't a supported way to allow you to just pick the dependencies for running the MergeSynchronizationAgent class although we have plans to come up with a merge module for replication components in the future. Realistically, it would be rather difficult to just pick out the dependencies for the MergeSynchronizationAgent class as it depends on things that folks normally don't suspect such as:

sqlncli.dll\rll

msvc80*.dll

The 2.0 .NET Framework

instapi.dll under 90\Share and corresponding registry key for locating it.

-Raymond