Showing posts with label location. Show all posts
Showing posts with label location. Show all posts

Thursday, March 29, 2012

Deriving unique rows from historical data

My application is to capture employee locations.

Whenever an employee arrives at a location (whether it is arriving for
work, or at one of the company's other sites) they scan the barcode on
their employee badge. This writes a record to the tblTSCollected table
(DDL and dummy data below).

The application needs to be able to display to staff in a control room
the CURRENT location of each employee.

>From the data I've provided, this would be:

EMPLOYEE ID LOCATION CODE
963 VB002
964 VB003
966 VB003
968 VB004
977 VB001
982 VB001

Note that, for example, Employee 963 had formerly been at VB001 but was
more recently logged in at VB002, so therefore the application is not
concerned with the earlier record.

What would also be particularly useful would be the NUMBER of staff at
each location - viz.

LOCATION CODE NUM STAFF
VB001 2
VB002 1
VB003 2
VB004 1

Can anyone help?

Many thanks in advance

Edward

NOTES ON DDL:

THE BARCODE IS CAPTURED BECAUSE THE COMPANY MAY RE-USE BARCODE NUMBERS
(WHICH IS DERIVED FROM THE EMPLOYEE PIN), SO THEREFORE THE BARCODE
CANNOT BE RELIED UPON TO BE UNIQUE.

THE COLUMN fldRuleAppliedID IS NULL BECAUSE THAT PARTICULAR ROW HAS NOT
BEEN PROCESSED. THERE ARE BUSINESS RULES CONCERNING EMPLOYEE HOURS
WHICH OPERATE ON THIS DATA. ONCE A ROW HAS BEEN PROCESSED FOR
UPLOADING TO THE PAYROLL APPLICATION, THE fldRuleAppliedID COLUMN WILL
CONTAIN A VALUE. IN THE PRODUCTION SYSTEM, THEREFORE, ANY SQL AS
REQUESTED ABOVE WILL CONTAIN IN ITS WHERE CLAUSE (fldRuleAppliedID Is
NULL)

if exists (select * from dbo.sysobjects where id =
object_id(N'[dbo].[tblTSCollected]') and OBJECTPROPERTY(id,
N'IsUserTable') = 1)
drop table [dbo].[tblTSCollected]
GO

CREATE TABLE [dbo].[tblTSCollected] (
[fldCollectedID] [int] IDENTITY (1, 1) NOT NULL ,
[fldEmployeeID] [int] NULL ,
[fldLocationCode] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
NULL ,
[fldTimeStamp] [datetime] NULL ,
[fldRuleAppliedID] [int] NULL ,
[fldBarCode] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO

INSERT INTO dbo.tblTSCollected
(fldEmployeeID,
fldLocationCode,
fldTimeStamp,
fldBarCode)
VALUES (
963, 'VB001', '2005-10-18 11:59:27.383', 45480)
INSERT INTO dbo.tblTSCollected
(fldEmployeeID,
fldLocationCode,
fldTimeStamp,
fldBarCode)
VALUES (
963, 'VB002', '2005-10-18 12:06:17.833', 45480)
INSERT INTO dbo.tblTSCollected
(fldEmployeeID,
fldLocationCode,
fldTimeStamp,
fldBarCode)
VALUES (
964, 'VB001', '2005-10-18 12:56:20.690', 45481)
INSERT INTO dbo.tblTSCollected
(fldEmployeeID,
fldLocationCode,
fldTimeStamp,
fldBarCode)
VALUES (964, 'VB002', '2005-10-18 15:30:35.117', 45481)
INSERT INTO dbo.tblTSCollected
(fldEmployeeID,
fldLocationCode,
fldTimeStamp,
fldBarCode)
VALUES (964, 'VB003', '2005-10-18 16:05:05.880', 45481)
INSERT INTO dbo.tblTSCollected
(fldEmployeeID,
fldLocationCode,
fldTimeStamp,
fldBarCode)
VALUES (966, 'VB001', '2005-10-18 11:52:28.307', 97678)
INSERT INTO dbo.tblTSCollected
(fldEmployeeID,
fldLocationCode,
fldTimeStamp,
fldBarCode)
VALUES (966, 'VB002', '2005-10-18 13:59:34.807', 97678)
INSERT INTO dbo.tblTSCollected
(fldEmployeeID,
fldLocationCode,
fldTimeStamp,
fldBarCode)
VALUES (966, 'VB001', '2005-10-18 14:04:55.820', 97678)
INSERT INTO dbo.tblTSCollected
(fldEmployeeID,
fldLocationCode,
fldTimeStamp,
fldBarCode)
VALUES (966, 'VB003', '2005-10-18 16:10:01.943', 97678)
INSERT INTO dbo.tblTSCollected
(fldEmployeeID,
fldLocationCode,
fldTimeStamp,
fldBarCode)
VALUES (968, 'VB001', '2005-10-18 11:59:34.307', 98374)
INSERT INTO dbo.tblTSCollected
(fldEmployeeID,
fldLocationCode,
fldTimeStamp,
fldBarCode)
VALUES (968, 'VB002', '2005-10-18 12:04:56.037', 98374)
INSERT INTO dbo.tblTSCollected
(fldEmployeeID,
fldLocationCode,
fldTimeStamp,
fldBarCode)
VALUES (968, 'VB004', '2005-10-18 12:10:02.723', 98374)
INSERT INTO dbo.tblTSCollected
(fldEmployeeID,
fldLocationCode,
fldTimeStamp,
fldBarCode)
VALUES (977, 'VB001', '2005-10-18 12:05:06.630', 96879)
INSERT INTO dbo.tblTSCollected
(fldEmployeeID,
fldLocationCode,
fldTimeStamp,
fldBarCode)
VALUES (982, 'VB001', '2005-10-18 12:06:13.787', 96697)On 25 Oct 2005 02:30:17 -0700, teddysnips@.hotmail.com wrote:

>My application is to capture employee locations.
>Whenever an employee arrives at a location (whether it is arriving for
>work, or at one of the company's other sites) they scan the barcode on
>their employee badge. This writes a record to the tblTSCollected table
>(DDL and dummy data below).

Hi Edward,

Thanks for posting the DDL and the data - makes writing and testing a
sloution so much easier!!

>The application needs to be able to display to staff in a control room
>the CURRENT location of each employee.
>>From the data I've provided, this would be:
>EMPLOYEE ID LOCATION CODE
>963 VB002
>964 VB003
>966 VB003
>968 VB004
>977 VB001
>982 VB001

This query works for the data given:

SELECT a.fldEmployeeID, a.fldLocationCode
FROM tblTSCollected AS a
WHERE NOT EXISTS
(SELECT *
FROM tblTSCollected AS b
WHERE b.fldEmployeeID = a.fldEmployeeID
AND b.fldTimeStamp > a.fldTimeStamp)

Since the data in the table is checked against the data in the table
itself, execution time might explode if the table has lots of rows. That
can be controlled with proper indexing. A non-clustered index on
(fldEmployeeID, fldTimeStamp) would do wonders for this query (but be
aware that it might hurt performance in other parts of your system!)

>What would also be particularly useful would be the NUMBER of staff at
>each location - viz.
>LOCATION CODE NUM STAFF
>VB001 2
>VB002 1
>VB003 2
>VB004 1

Using the previous query as a starting point:

SELECT a.fldLocationCode, COUNT(*) AS Num_Staff
FROM tblTSCollected AS a
WHERE NOT EXISTS
(SELECT *
FROM tblTSCollected AS b
WHERE b.fldEmployeeID = a.fldEmployeeID
AND b.fldTimeStamp > a.fldTimeStamp)
GROUP BY a.fldLocationCode

Best, Hugo
--

(Remove _NO_ and _SPAM_ to get my e-mail address)|||Hugo Kornelis wrote:
> On 25 Oct 2005 02:30:17 -0700, teddysnips@.hotmail.com wrote:
[...]
> Best, Hugo

Many thanks, Hugo. That does the trick perfectly!

Edward|||Your DDL is wrong in almost every way possible. IDENTITY is not a key,
barcodes are fixed length and none of them are CHAR(50) -- you never
did even the minimal research!! You use the magical, "I have no
brains!!" VARCHAR(50) all over the place, TIMESTAMP is a reserved word
in SQL, etc.

Where did you get the stupid idea that you need to put "fld-" and
"tbl-" prefixes on names? In violation of both common sense and
ISO-11179? One of the major principles of RDBMS is to avoid redundance;
Do you put "noun-" in your English?

When you design a history table, you need to learn that time comes in
durations; you need a (stsrt, end). You need to think of the schema as
a whole and not a bunch disjoint files. you need to avoid havign more
NULLs than the entie payroll of Genral Motors. More like this: .

CREATE TABLE EmpLocationHistory
(emp_id INTEGER NOT NULL
REFERENCES Personnel(emp_id)
ON UPDATE CASCADE,
location_code INTEGER NOT NULL
REFERENCES Locations(location_code)
ON UPDATE CASCADE,
start_time DATETIME NOT NULL,
end_time DATETIME, -- null means current
CHECK (start_time < end_time),
PRIMARY KEY (emp_id, location_code,start_time),
etc. );

Google how to code for this schema.

Among the errors in this posting, you do not know that SQL uses
ISO-8601 format for temporal data. You might want to look at the
research on camelCase and program readability; it sucks because the eye
jumps to the uppercase letter then flicks back to the start of the
word.

I was not kidding when I said that your code is wrong in almost every
way possible.|||Wow! Where can I send you some money so you can buy your medication
and calm the fuck down?

There is a right way and a wrong way to correct people. You use the
wrong (read, asshole) way. There is no call for lines like "I have no
brains!!" or "stupid idea".

Being civil is worth so much more than posting DDL or not calling a
column a field and a row a record.

Get a grip and be nicer.

Sunday, March 11, 2012

Deploying reports to remote location

i am new in report service development.
currently I deployed reports on development server by vs.net.
I also aware about how to use report manager to deploy reports on server.
but both approaches need access to report server.
But now i have to deploy them on production server where i am not having
access.
Client ask us for some sort of setup program so that they can deploy them.
How can i do this.These is reporting webservice available at
http://<machine_name>/reportserver/reportservice.asmx
There are some functions provided by this webservice like CreateReport(),
which can be used for publishing reports. You will be required to write a
custom DLL to accomplish this and call the DLL from a setup program
Let me know if you have further queries
Bye
Sumit Pilankar
"vibha" <vibha@.discussions.microsoft.com> wrote in message
news:BD205062-FD5E-4C71-AAD4-D966428D668A@.microsoft.com...
>i am new in report service development.
> currently I deployed reports on development server by vs.net.
> I also aware about how to use report manager to deploy reports on server.
> but both approaches need access to report server.
> But now i have to deploy them on production server where i am not having
> access.
> Client ask us for some sort of setup program so that they can deploy them.
> How can i do this.

Wednesday, March 7, 2012

Deploying Analysis Server Project to another domain

I am looking for a way to deploy an Analysis Server 2005 project to a remote location. I can generate and XMLA create script, FTP the script to the remote location, and execute it to create the cube database on the other server.

However, the security roles inthe XMLA file contains SIDs instead of Active Directory Security group names. The server I am moving this database to is in another Domain and so the SIDs don't correspond to the same users. However, the Active Directory group names on the remote server are exactly the same as the Active Directory group names in my local domain. (The group names are the names of companies).

I am looking for a way to deploy this project to my remote server with the SIDs converted to the Active Directory group names.

Does anyone have any ideas? This type of deployment scenario will be quite common in my development environment.

I am using SQL2005 SP2, along with Visual Studio 2005.

Have a look at the Analysis Services Deployment Wizard, it has options for either

deploying the roles in full|||

I'll throw in my two cents. If the XMLA for your role contains:

<Members>

<Member>

<Name>YOURDOMAIN\yourusername</Name>

<Sid>S-1-5-21-4211028405-896031999-4015973603-1183</Sid>

</Member>

</Members>

I believe that you can cut out the Sid entirely. The following XMLA works fine for me:

<Members>

<Member>

<Name>YOURDOMAIN\yourusername</Name>

</Member>

</Members>

As for whether you can do without YOURDOMAIN\ in the above, I'm not sure. I know that if the group is local to the computer you're, then leaving off the domain works. But if it's a domain group, I'm guessing you've got to specify the domain. Worth testing, though.

Deploying Analysis Server Project to another domain

I am looking for a way to deploy an Analysis Server 2005 project to a remote location. I can generate and XMLA create script, FTP the script to the remote location, and execute it to create the cube database on the other server.

However, the security roles inthe XMLA file contains SIDs instead of Active Directory Security group names. The server I am moving this database to is in another Domain and so the SIDs don't correspond to the same users. However, the Active Directory group names on the remote server are exactly the same as the Active Directory group names in my local domain. (The group names are the names of companies).

I am looking for a way to deploy this project to my remote server with the SIDs converted to the Active Directory group names.

Does anyone have any ideas? This type of deployment scenario will be quite common in my development environment.

I am using SQL2005 SP2, along with Visual Studio 2005.

Have a look at the Analysis Services Deployment Wizard, it has options for either

deploying the roles in full|||

I'll throw in my two cents. If the XMLA for your role contains:

<Members>

<Member>

<Name>YOURDOMAIN\yourusername</Name>

<Sid>S-1-5-21-4211028405-896031999-4015973603-1183</Sid>

</Member>

</Members>

I believe that you can cut out the Sid entirely. The following XMLA works fine for me:

<Members>

<Member>

<Name>YOURDOMAIN\yourusername</Name>

</Member>

</Members>

As for whether you can do without YOURDOMAIN\ in the above, I'm not sure. I know that if the group is local to the computer you're, then leaving off the domain works. But if it's a domain group, I'm guessing you've got to specify the domain. Worth testing, though.

Deploying a SSAS solution from File location using C#

Hi all,
i have created a SSAS solution using BIDS . I have saved the project on local hard disk. Now i need to deploy the solution through C# and not use C#. Can i do that ? if how how?

Regards..
Girija Shankar

Could you describe your goals a bit more? When you create an SSAS solution with BIDS, a script file is created that can be used to deploy a database to SSAS. You could also use the ASCMD application to submit scripts or execute a script via AMO. (I believe the Server object's Execute method handles this.)

B.

|||

Hi Bryan,

Thanks for the reply. The scenario is as folows:

1. I create a SSAS solution. i create the datasource,DSv,cubes and dimensions and Roles.I donot deploy that to the server but save the file to a local drive location.

2. If i go to the local directory path where I saved the solution i will find files such as .database, .cube,.partitions, .dim etc

3. i need to deploy the full solution from this file location to the server. After deployement i can process the cubes one by one using AMO. The processing part is clear to me using AMO but how to deploy from file location i am not able to figure out . All this has to be done through code (C#).

Regards...

Girija Shankar

|||

So, the file in the BIN folder is a complete or near-complete script. You should be able to use standard techniques to read the file (it's just XML though I would read it as a simple text file). With the script in memory, you can then submit it as a string through the AMO Server object's Execute method.

You may also want to review the ASCMD project that comes with the SSAS samples. I believe it has the functionality built in to read a file and execute it like I'm describing. It's also written in C#.

B.

|||

Bryan,

There are four files in bin folder . i suppose i would be using .asdatabase file. read that,envolope that with the create and Object Tags and execute that on server. Is this correct?

Regards...

Girija Shankar

|||

Hi, Another question.

There are some read only tags such as CreatedTimestamp, should i remove them while reading that?

Regards...
Girija Shankar

|||Another option is to use the Deployment Wizard (launched from the Start menu under Microsoft SQL Server->Analysis Services). This wizard has the option to generate a deployment script which is just an XMLA

command that can be sent the the server to deploy and optionally process the cube. This script deployment can be done using Adomd.Net, an XMLA Query in SQL Management Studio, or using the ASCMD.exe command line utilility available at http://www.microsoft.com/downloads/details.aspx?familyid=e719ecf7-9f46-4312-af89-6ad8702e4e6e&displaylang=en.

Deploying a SSAS solution from File location using C#

Hi all,
i have created a SSAS solution using BIDS . I have saved the project on local hard disk. Now i need to deploy the solution through C# and not use C#. Can i do that ? if how how?

Regards..
Girija Shankar

Could you describe your goals a bit more? When you create an SSAS solution with BIDS, a script file is created that can be used to deploy a database to SSAS. You could also use the ASCMD application to submit scripts or execute a script via AMO. (I believe the Server object's Execute method handles this.)

B.

|||

Hi Bryan,

Thanks for the reply. The scenario is as folows:

1. I create a SSAS solution. i create the datasource,DSv,cubes and dimensions and Roles.I donot deploy that to the server but save the file to a local drive location.

2. If i go to the local directory path where I saved the solution i will find files such as .database, .cube,.partitions, .dim etc

3. i need to deploy the full solution from this file location to the server. After deployement i can process the cubes one by one using AMO. The processing part is clear to me using AMO but how to deploy from file location i am not able to figure out . All this has to be done through code (C#).

Regards...

Girija Shankar

|||

So, the file in the BIN folder is a complete or near-complete script. You should be able to use standard techniques to read the file (it's just XML though I would read it as a simple text file). With the script in memory, you can then submit it as a string through the AMO Server object's Execute method.

You may also want to review the ASCMD project that comes with the SSAS samples. I believe it has the functionality built in to read a file and execute it like I'm describing. It's also written in C#.

B.

|||

Bryan,

There are four files in bin folder . i suppose i would be using .asdatabase file. read that,envolope that with the create and Object Tags and execute that on server. Is this correct?

Regards...

Girija Shankar

|||

Hi, Another question.

There are some read only tags such as CreatedTimestamp, should i remove them while reading that?

Regards...
Girija Shankar

|||Another option is to use the Deployment Wizard (launched from the Start menu under Microsoft SQL Server->Analysis Services). This wizard has the option to generate a deployment script which is just an XMLA

command that can be sent the the server to deploy and optionally process the cube. This script deployment can be done using Adomd.Net, an XMLA Query in SQL Management Studio, or using the ASCMD.exe command line utilility available at http://www.microsoft.com/downloads/details.aspx?familyid=e719ecf7-9f46-4312-af89-6ad8702e4e6e&displaylang=en.

Deploying a report to remote server

I would like to develop a report remotely for a customer, and then
deploy it on their intranet at their location. Basically all
development is
off-site, and I will travel onsite to install the completed SRS report.
They
do not have a licensed copy of Visual Studio .NET, so none of the
development/maintenance will be done on their server. When I go to
install
SRS on their server, I will only install the Server components, not the
client components. With that said, how do go about getting the actual
report
installed / deployed on their server? I can do it locally on my
development
box using "deploy" from within VS.NET, but how do I do it "manually" on
a box
without VS.NET? What report "files" do I need to copy from my machine,
and
what needs to be setup in IIS?
Thanks
VikramYou can use report manager to deploy a rdl file (if you don't have a lot
this would be the easiest to do.
Or you can script the deploy. You don't have to have a 3rd party tool for
this but here is a free one from Jasper Smith a SQL Server MVP.
Reporting Services Scripter
http://www.sqldbatips.com/showarticle.asp?ID=62
Bruce Loehle-Conger
MVP SQL Server Reporting Services
<vikram.sattenapalli@.gmail.com> wrote in message
news:1140556432.452749.103260@.o13g2000cwo.googlegroups.com...
> I would like to develop a report remotely for a customer, and then
> deploy it on their intranet at their location. Basically all
> development is
> off-site, and I will travel onsite to install the completed SRS report.
> They
> do not have a licensed copy of Visual Studio .NET, so none of the
> development/maintenance will be done on their server. When I go to
> install
> SRS on their server, I will only install the Server components, not the
> client components. With that said, how do go about getting the actual
> report
> installed / deployed on their server? I can do it locally on my
> development
> box using "deploy" from within VS.NET, but how do I do it "manually" on
> a box
> without VS.NET? What report "files" do I need to copy from my machine,
> and
> what needs to be setup in IIS?
> Thanks
> Vikram
>|||Thanks a lot for the quick response. I will try using the third party
tool and see if i can actually generate the script :)
Vikram

Friday, February 17, 2012

Dependent report parameters help

I have four parameters for my report: StartDate, EndDate, TankID (the ID of a thank going from V01 to V20 and from S01 to S20) and Site (the location of the tanks, for example: the V-tanks are in Belgium (BE) and the S-tanks are in Spain (SP))

The thing I want to do is: If I set parameter "Site" to "Belgium" then only the tanks in belgium will be shown as values in the dropdown of the "TankID" parameter. If site = Spain, only spanish tanks will be shown in tankid parameter dropdown box.

I tried adding a new dataset which has as default value the parameter of the "Site". Also tried some other stuff but the only thing i get is this error:

Error 4 [rsInvalidReportParameterDependency]
The report parameter ‘BLABLA’ has a DefaultValue or a ValidValue that depends on the report parameter “BLEBLE”. Forward dependencies are not valid.

So the thing I want to use are parameters that depend on eachother. If anyone made that possible, please let me know how!

Greets
Wim

See this link on msdn:

http://msdn2.microsoft.com/en-us/library/ms155917.aspx

Scroll all the way down to the very last section entitled "Cascading Parameters". I believe this is what you are trying to do. Let me know if I can help further.

|||

Just Change the order of the report parameters

i:e if Changing ParaA updates ParaB Drop-down values, then place ParaA before ParaB

|||

I haven't read the msdn page yet, I just started with the second option (changing parameter order) to see if that works and IT DOES!!!!

You just have to place the depentent parameter below the one it depends on and all works fine! (so in my case I placed the tank parameter below the site parameter)

Thanks for your help
greets

Wim

|||

Hello

Can we make Multivalue parameters to play for cascading parameters. I am trying with different combinations of using query parameters and Report parameters.

Can any body help me?

Regards

Raj Deep.A

Dependent report parameters help

I have four parameters for my report: StartDate, EndDate, TankID (the ID of a thank going from V01 to V20 and from S01 to S20) and Site (the location of the tanks, for example: the V-tanks are in Belgium (BE) and the S-tanks are in Spain (SP))

The thing I want to do is: If I set parameter "Site" to "Belgium" then only the tanks in belgium will be shown as values in the dropdown of the "TankID" parameter. If site = Spain, only spanish tanks will be shown in tankid parameter dropdown box.

I tried adding a new dataset which has as default value the parameter of the "Site". Also tried some other stuff but the only thing i get is this error:

Error 4 [rsInvalidReportParameterDependency]
The report parameter ‘BLABLA’ has a DefaultValue or a ValidValue that depends on the report parameter “BLEBLE”. Forward dependencies are not valid.

So the thing I want to use are parameters that depend on eachother. If anyone made that possible, please let me know how!

Greets
Wim

See this link on msdn:

http://msdn2.microsoft.com/en-us/library/ms155917.aspx

Scroll all the way down to the very last section entitled "Cascading Parameters". I believe this is what you are trying to do. Let me know if I can help further.

|||

Just Change the order of the report parameters

i:e if Changing ParaA updates ParaB Drop-down values, then place ParaA before ParaB

|||

I haven't read the msdn page yet, I just started with the second option (changing parameter order) to see if that works and IT DOES!!!!

You just have to place the depentent parameter below the one it depends on and all works fine! (so in my case I placed the tank parameter below the site parameter)

Thanks for your help
greets

Wim

|||

Hello

Can we make Multivalue parameters to play for cascading parameters. I am trying with different combinations of using query parameters and Report parameters.

Can any body help me?

Regards

Raj Deep.A