Showing posts with label names. Show all posts
Showing posts with label names. Show all posts

Sunday, March 25, 2012

Computing and assigning a value to a textbox from other data regions

I am new to SSRS, so perhaps its a trivial question. I was wondering that since all controls have names in the report, is it possible to programatically access values of different textboxes, do some computation and then assign to another text box? I know how to do it using the Aggregate functions and operators, but am not sure if I can access values from textboxes within two different tables and assign the computed value to a third text box on the page (not belonging to any table or other control).

somethig like.... txtTotal.Value = FormatCurrency(txtSalesTotal.Value) - txtDiscount.Value));

Any ideas?

DNG.

People!!!!!!!!!!!

How can I add values in two text boxes and display in the third one? Apparently I can't do this simple thing in SSRS or may be I am missing something? I remember you can do this in Crystal by accessing textbox control and can access their values to be used elsewhere on the page. Can we create variables, where I can store the value of a text box and use it later in other text boxes?

Plz. help!!!

DNG

|||

Let's see if I understand what you are asking. TextBox1 has the sum of values from DataSet1. TextBox2 has the sum of values from DataSet2. These text boxes are not in a table. To sum the value you would need the following in the expression of textbox3:

Code Snippet

=reportitems!TextBox1.Value + reportitems!TextBox2.Value

Hope this helps.

Simone

|||If any of these textboxes are in tables (which I believe you may have mentioned) then you can only reference items within the same scope and you will receive errors.|||

I should add that in the above case, you can use the expression contained within the first two text boxes to give you the value in the 3rd.

ex. TextBox3 expression =

Code Snippet

=Sum(Fields!Value.Value, "dsTest") + Sum(Fields!Value.Value, "dsTest2")

Simone|||Thanks for your help.sqlsql

Tuesday, March 20, 2012

COMPOSITE PRIMARY KEYS

Hi,
I have 150 tables in a database.
Composite primary key is used in some of those tables.
Can I list out the table names having composite primary key.
Thanks,
Soura
SouRa
Run the following in Query Analyzer-
select name from sysindexes where keycnt <> 0
Hope that helps,
Donna
"SouRa" wrote:

> Hi,
> I have 150 tables in a database.
> Composite primary key is used in some of those tables.
> Can I list out the table names having composite primary key.
> Thanks,
> Soura

Sunday, March 11, 2012

complicated query

I have a table which has 4 columns
Sales_person, vehicle_id, price, date
I want a query to return names of the sales persons who sold the
vehicle at a record price in the month of may 2006.
say if sales person A sold a car for 25k in April 06 and 26k in may 06
I want the record high price for all sales if occured in may 06. But if
B sold 2 cars for 26k, 28k in may 06 but another car for 30k in dec
2005 I do not want that record.
any help with this query.I'm just guessing at what you want, but here are two
possibilities.
Since there is only one record high price, maybe you
want just want all sales at the record high price that
happened to occur in May, 2005:
select
Sales_person, Vehicle_id, price, date
from T
where
date >= '20050501'
and date < '20050601'
and price = (
select max(price)
from T
)
Your explanation is more complicated, but I can't figure
out what else it might mean.
Steve Kass
Drew University
http://www.stevekass.com
VJ wrote:

>I have a table which has 4 columns
>Sales_person, vehicle_id, price, date
>I want a query to return names of the sales persons who sold the
>vehicle at a record price in the month of may 2006.
>say if sales person A sold a car for 25k in April 06 and 26k in may 06
>I want the record high price for all sales if occured in may 06. But if
>B sold 2 cars for 26k, 28k in may 06 but another car for 30k in dec
>2005 I do not want that record.
>any help with this query.
>
>|||Look into datepart and max
"VJ" <vishal.sql@.gmail.com> wrote in message
news:1149533614.614289.111110@.h76g2000cwa.googlegroups.com...
>I have a table which has 4 columns
> Sales_person, vehicle_id, price, date
> I want a query to return names of the sales persons who sold the
> vehicle at a record price in the month of may 2006.
> say if sales person A sold a car for 25k in April 06 and 26k in may 06
> I want the record high price for all sales if occured in may 06. But if
> B sold 2 cars for 26k, 28k in may 06 but another car for 30k in dec
> 2005 I do not want that record.
> any help with this query.
>

Friday, February 24, 2012

complex and or query

Hi,
Anyone able to help? XTab wont work.
Have a table containing names of people.
Mark
John
Mary
They answer up to 10 questions each. The answers are
unique id numbers kept in the same column
ResultsTable
QuestionID AnswerID Answer Name
1 001 Apple John
2 005 Holden John
3 010 20 John
1 002 Orange Mary
2 006 VW Mary
3 011 30 Mary
Need to be able to have a stored procedure that allows me
to select (for example) everyone who chose fruit = apple
or orange and cartype = Holden and age > 25
The problem is, doing a simple and returns no results
because of the single column for the AnswerID. Doing an
or will return anyone answering either of these answers.
Any ideas?I'm not sure why you have both answerid and answer columns in this table.
Since answerid appears to be redundant I've ignored it.
CREATE TABLE Answers (questionid INTEGER NOT NULL, answer VARCHAR(10) NOT
NULL, firstname VARCHAR(10) NOT NULL, PRIMARY KEY (firstname,questionid))
INSERT INTO Answers VALUES (1, 'Apple', 'John')
INSERT INTO Answers VALUES (2, 'Holden', 'John')
INSERT INTO Answers VALUES (3, '20', 'John')
INSERT INTO Answers VALUES (1, 'Orange', 'Mary')
INSERT INTO Answers VALUES (2, 'VW', 'Mary')
INSERT INTO Answers VALUES (3, '30', 'Mary')
CREATE TABLE Criteria (questionid INTEGER NOT NULL, min_answer VARCHAR(10)
NOT NULL, max_answer VARCHAR(10) NULL, PRIMARY KEY (questionid, min_answer))
INSERT INTO Criteria VALUES (1,'Apple',NULL)
INSERT INTO Criteria VALUES (1,'Orange',NULL)
INSERT INTO Criteria VALUES (2,'Holden',NULL)
INSERT INTO Criteria VALUES (3,'20','999')
Here's the query that gives people who match at least one answer in the
Criteria table for each of the questions in the Criteria table.
SELECT firstname
FROM Answers AS A
JOIN Criteria AS C
ON A.questionid = C.questionid
AND A.answer BETWEEN C.min_answer AND COALESCE(C.max_answer,
C.min_answer)
GROUP BY firstname
HAVING COUNT(DISTINCT A.questionid)= (SELECT COUNT(DISTINCT questionid)
FROM Criteria)
--
David Portas
--
Please reply only to the newsgroup
--