Showing posts with label header. Show all posts
Showing posts with label header. Show all posts

Thursday, March 22, 2012

about error message - lost file header

I made a mistake in copying my database and somehow lost my file header. How do I recreate my file header without losing all the data in my database? Is there a way to undo my mistake?

Thanks

Debbie

I don't know what you mean by a file header. Is this a SQL Server database? How does this relate to SSIS?

Is the file header part of the database, or are you just talking about a text file with header information in it? Why would this mean you would loose data in a database?

Thursday, February 9, 2012

(RS 2000) Row Count in Header?

I am using Reporting Services 2000 and need to know if there is a way to
list the number of rows returned in the Header or Footer?
Any help is greatly appreciated.
- CarlCarl,
If you use the COUNT function in SSRS, it should calculate that for
you. In one of the header/footer cells, make the expression something
like: =Count(Fields!fieldName.Value)
You can make these more informative by putting a descriptor after the
count value like: =Count(Fields!fieldName.Value) &
Iif(Count(Fields!fieldName.Value) = 1, " Employee", " Employees")
Also, the count function just looks within its own scope. If you use a
table header, it looks at the whole table. If you use a group header,
it looks just within its group.
Hope this helps!
-Josh
Vagabond Software wrote:
> I am using Reporting Services 2000 and need to know if there is a way to
> list the number of rows returned in the Header or Footer?
> Any help is greatly appreciated.
> - Carl|||"Josh" <bell.joshua@.gmail.com> wrote in message
news:1155300982.086540.318880@.p79g2000cwp.googlegroups.com...
> Carl,
> If you use the COUNT function in SSRS, it should calculate that for
> you. In one of the header/footer cells, make the expression something
> like: =Count(Fields!fieldName.Value)
> You can make these more informative by putting a descriptor after the
> count value like: =Count(Fields!fieldName.Value) &
> Iif(Count(Fields!fieldName.Value) = 1, " Employee", " Employees")
> Also, the count function just looks within its own scope. If you use a
> table header, it looks at the whole table. If you use a group header,
> it looks just within its group.
> Hope this helps!
> -Josh
Though I couldn't use the COUNT function in the Header or the Footer, I was
able to make space in the Body, above the table, to use the function.
Thanks for the help.
- Carl|||Carl,
Glad you got it working, but you might want to further investigate the
Count problem... I borrowed a friends workstation that has SSRS 2000
and confirmed that the Count function DOES work in that version of the
product.
I made a simple query that returned 1 field and put a Count expression
in the table footer. It displayed the correct number.
Best wishes!
-Josh
Vagabond Software wrote:
> "Josh" <bell.joshua@.gmail.com> wrote in message
> news:1155300982.086540.318880@.p79g2000cwp.googlegroups.com...
> >
> > Carl,
> >
> > If you use the COUNT function in SSRS, it should calculate that for
> > you. In one of the header/footer cells, make the expression something
> > like: =Count(Fields!fieldName.Value)
> >
> > You can make these more informative by putting a descriptor after the
> > count value like: =Count(Fields!fieldName.Value) &
> > Iif(Count(Fields!fieldName.Value) = 1, " Employee", " Employees")
> >
> > Also, the count function just looks within its own scope. If you use a
> > table header, it looks at the whole table. If you use a group header,
> > it looks just within its group.
> >
> > Hope this helps!
> >
> > -Josh
>
> Though I couldn't use the COUNT function in the Header or the Footer, I was
> able to make space in the Body, above the table, to use the function.
> Thanks for the help.
> - Carl|||"Josh" <bell.joshua@.gmail.com> wrote in message
news:1155530591.436146.248650@.75g2000cwc.googlegroups.com...
> Carl,
> Glad you got it working, but you might want to further investigate the
> Count problem... I borrowed a friends workstation that has SSRS 2000
> and confirmed that the Count function DOES work in that version of the
> product.
> I made a simple query that returned 1 field and put a Count expression
> in the table footer. It displayed the correct number.
> Best wishes!
> -Josh
I will keep playing with it, but if I add a Textbox to the footer and
attempt to use the Count expression in the Value property of that Textbox, I
get a build error something like this:
"The value expression for the textbox 'textbox15' refers to a field. Fields
cannot be used in page headers or footers."
Thanks for all the help.
- carl|||Carl,
You are adding the textbox to the PAGE footer, not the table footer.
The table is bound to a dataset, so you can reference a field in the
table footer by using "Fields!fieldName.Value" without having to
specify the dataset to which that field belongs.
If you add a textbox to the body, page header, or page footer, you need
to reference the dataset as well. Usually, one you do this, it has to
return a scalar value, so you might be forced to use a First, Last,
Sum, Count, etc. function to condense the result into a single value.
If you use the expression builder (right-click on the textbox and
select Expression), you can click on Datasets on the left and see your
options. If it is a text datatype, I think it defaults to First; if it
is a number datatype, I think it defaults to Sum. The expression will
automatically add the name of the dataset using the correct syntax.
If you need it in the PAGE footer, try this approach. If you meant it
to be a table footer, it should be a simple
Count(Fields!fieldName.Value).
Any closer?
-Josh
Vagabond Software wrote:
> "Josh" <bell.joshua@.gmail.com> wrote in message
> news:1155530591.436146.248650@.75g2000cwc.googlegroups.com...
> >
> > Carl,
> >
> > Glad you got it working, but you might want to further investigate the
> > Count problem... I borrowed a friends workstation that has SSRS 2000
> > and confirmed that the Count function DOES work in that version of the
> > product.
> >
> > I made a simple query that returned 1 field and put a Count expression
> > in the table footer. It displayed the correct number.
> >
> > Best wishes!
> >
> > -Josh
> I will keep playing with it, but if I add a Textbox to the footer and
> attempt to use the Count expression in the Value property of that Textbox, I
> get a build error something like this:
> "The value expression for the textbox 'textbox15' refers to a field. Fields
> cannot be used in page headers or footers."
> Thanks for all the help.
> - carl

(Revised)Database Design question, Header with two detail.. pls help

Hi All,
There is some additional info I forget on this same topic I just posted.

I have a database design question, pls give me some help..

I want to define tables for salesman's sales target commission . The
commission could be given per EITHER sales amount of : Group of Products OR
Group of Brand. e.g : the data example :
For one salesman_A :
product_1, product_2, product_3 etc.. => sales = $100 - $200 =>
commission = 5%
product_1, product_2, product_3 etc.. => sales = $201 - $400 =>
commission = 10%
Brand_A, Brand_B, Brand_C .. etc => sales = $100 - $200 =>
commission = 2.5%
Brand_A, Brand_B, Brand_C .. etc => sales = $201 - $400 =>
commission = 5%

Below is my table design, is this a good design or something is wrong here ?
Thank you for your help.

CREATE TABLE Sales_Commission_Header (
Sales_ID Char(4) ,
Sales_Commission_Group Char(4),
Note Varchar(30),
Constraint Sales_Commission_Header_PK Primary Key(Sales_ID,
Sales_Commission_Group)
)
Alter Table Sales_Commission_Header Add Constraint
FK_Sales_Commission_Header Foreign Key (Sales_Commission_Group)
References Commission_Group_Header(Sales_Commission_Group)

CREATE TABLE Sales_Commission_Detail (
Sales_ID Char(4) ,
Sales_Commission_Group Char(4),
Sales_From Decimal(12,2) ,
Sales_To Decimal(12,2) ,
Commission Decimal(5,2),
Constraint Sales_Commission_Detail_PK Primary Key(Sales_ID,
Sales_Commission_Group, Sales_From, Sales_To)
)
Alter Table Sales_Commission_Detail Add Constraint FK_Sales_Commission
Foreign Key (Sales_ID, Sales_Commission_Group) References
Sales_Commission_Header(Sales_ID, Sales_Commission_Group)

--------------

** ALTERNATIVE _1 :

CREATE TABLE Commission_Group_Header (
Sales_Commission_Group Char(4) Primary Key,
Note Varchar(30)
)

CREATE TABLE Commission_Group_Detail_Product (
Sales_Commission_Group Char(4),
Product_ID VarChar(10), -- This product_ID will be FK
reference to master product
Constraint Commission_Group_Detail_Product_PK Primary
Key(Sales_Commission_Group, Product_ID)
)
Alter Table Commission_Group_Detail_Product Add Constraint
FK_Commission_Group_Detail_Product Foreign Key (Sales_Commission_Group)
References Commission_Group_Header(Sales_Commission_Group)

CREATE TABLE Commission_Group_Detail_Brand (
Sales_Commission_Group Char(4),
Brand_ID VarChar(10), -- This brand_ID will be FK
reference to master brand
Constraint Commission_Group_Detail_Brand_PK Primary
Key(Sales_Commission_Group, Brand_ID)
)
Alter Table Commission_Group_Detail_Brand Add Constraint
FK_Commission_Group_Detail_Brans Foreign Key (Sales_Commission_Group)
References Commission_Group_Header(Sales_Commission_Group)

** ALTERNATIVE _2 :

CREATE TABLE Commission_Group_Header (
Sales_Commission_Group Char(4),
Group_Type Char(1), -- 'B': Brand Group 'P': Product Group
Note Varchar(30),
Constraint Commission_Group_Header_PK Primary Key(Sales_Commission_Group,
Group_Type)
)

CREATE TABLE Commission_Group_Detail (
Sales_Commission_Group Char(4),
Group_Type Char(1), -- 'B': Brand Group 'P': Product Group
Product_Brand_ID VarChar(10),
Constraint Commission_Group_Detail_PK Primary Key(Sales_Commission_Group,
Group_Type, Product_Brand_ID)
)
Alter Table Commission_Group_Detail Add Constraint
FK_Commission_Group_Detail Foreign Key (Sales_Commission_Group)
References Commission_Group_Header(Sales_Commission_Group, Group_Type)

The PROBLEM here is : with Product_Brand_ID , I CAN NOT make foreign key
into both Master Product and Master Brand.

So which one is better design ?
split the Commission_Group_Detail into Two tables, product and brand , and
make the FOREIGN KEY
to master product and master brand (previous mail)
OR
combile Commission_Group_Detail for Product and Brand into one table like
above
and NOT make any FK to master Product or Brand ?

Thank you for your help,
TristantKrist (xtanto@.hotmail.com) writes:
> I have a database design question, pls give me some help..

For some reason Krist also mailed me about this - please do not both
post and mail! - and I gave him suggestions. I'm leaving this post
here as a bookmark, to mark this question as answered.

Briefly, I first suggested that in his first details table to replace
Sales_From and Sales_To with a nullable column Upperlimit. For the key
I suggested to have RowNo a running number within the Product_ID.
A trigger may be required to ensure that Upperlimit grows with RowNo.
For updates it's best to flush all rows for the product and reload.

For the other question about Product_Brand_ID, I suggested that one
alternative would be to create a supertable with both ids in them.
Another alternative would be two have two columns, and a check
constraint requiring that exactly one of them be non-NULL. This would
call for a surrogate key to be used in the table with the commission
levels.

Since I did not have full information of the meaning of brands and
products, none of these suggestions may make sense.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp