Skip to main content



      Home
Home » Archived » BIRT » How to use a value from one of the
How to use a value from one of the [message #75918] Tue, 20 September 2005 11:12 Go to next message
Eclipse UserFriend
Originally posted by: ahundal.research.telcordia.com

Hi everyone,
I am new to using BIRT, so maybe the question comes as a naive one.
Can anyone tell me how to use a value from a column of a table ( that i
fetched from the database) to filter data from some other table and
display it? For example, if there are two tables A and B, then after
fetching table A, I want to fetch only those elements from table B that
have the same value as one of the fields of table A.
I would appreciate your help.
Thanks and best regards
Ahsan hundal
Re: How to use a value from one of the [message #75936 is a reply to message #75918] Tue, 20 September 2005 12:02 Go to previous messageGo to next message
Eclipse UserFriend
Ahsan,

This is probaly better done in the query. If you use any of the filters
available you will have excess rows that are fetched.

Jason Weathersby
BIRT PMC

"Ahsan Hundal" <ahundal@research.telcordia.com> wrote in message
news:4571c63a2addd33d53b3554ca56f4d64$1@www.eclipse.org...
> Hi everyone,
> I am new to using BIRT, so maybe the question comes as a naive one. Can
> anyone tell me how to use a value from a column of a table ( that i
> fetched from the database) to filter data from some other table and
> display it? For example, if there are two tables A and B, then after
> fetching table A, I want to fetch only those elements from table B that
> have the same value as one of the fields of table A. I would appreciate
> your help.
> Thanks and best regards
> Ahsan hundal
Re: How to use a value from one of the [message #75967 is a reply to message #75936] Tue, 20 September 2005 13:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ahundal.research.telcordia.com

Thanks for your response, but i want to use a value fetched from one of
the tables and use it to fetch other records from some other table based
on that value. To accomplish that I would have to create a dynamic query,
which uses values fetched from the other table. How can i accomplish it in
BIRT? Eg. I want a report containing the name of a person in the first
column and then the number of transactions he made in the second. The name
is stored in a separate table and the number of transactions in a separate
and linked through the userId. how do I show it?
I would appreciate your help
Thanks
Ahsan
Re: How to use a value from one of the [message #75986 is a reply to message #75967] Tue, 20 September 2005 13:40 Go to previous messageGo to next message
Eclipse UserFriend
If you want only one html table in the output and in the first column all
the users and in the second column all there transactions, why would you not
just put your query in like

select usertable.user, sum(trantable.transactions)
from usertable, trantable
where usertable.userId = trantable.userID
group by usertable.user

If you only want the table to contain one user use a dataset parameter


select usertable.user, sum(trantable.transactions)
from usertable, trantable
where usertable.userId = trantable.userID
and usertable.user = ?
group by usertable.user

I am probally misunderstanding what you want.

Jason Weathersby
BIRT PMC

"Ahsan Hundal" <ahundal@research.telcordia.com> wrote in message
news:deeacee6a68d9c4c31253eb41ee97281$1@www.eclipse.org...
> Thanks for your response, but i want to use a value fetched from one of
> the tables and use it to fetch other records from some other table based
> on that value. To accomplish that I would have to create a dynamic query,
> which uses values fetched from the other table. How can i accomplish it in
> BIRT? Eg. I want a report containing the name of a person in the first
> column and then the number of transactions he made in the second. The name
> is stored in a separate table and the number of transactions in a separate
> and linked through the userId. how do I show it?
> I would appreciate your help
> Thanks
> Ahsan
Re: How to use a value from one of the [message #76031 is a reply to message #75986] Tue, 20 September 2005 14:49 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ahundal.research.telcordia.com

Sorry for being a bit ambiguous. Let me clarify to you exactly what i want
to do. The customers table has a list of the customers names and the
customer ids.
Customer Table:
customerId customerName

Now in the transaction table there is customer id and then transaction
id alongwith the time it was created.
Transaction Table:
transactionId customerId timeOfCreation

So what I have to do is to display the customer name and then with the
customers name i need to display the number of transactions he made within
the last day or month. They should be in sync. this should be the HTML
table

CustomerName #ofTransactions

I hope now things wud be more clear.
I would appreciate ur help again and thanks for ur responses.
Best regards
ahsan
Re: How to use a value from one of the [message #76059 is a reply to message #76031] Tue, 20 September 2005 18:07 Go to previous message
Eclipse UserFriend
Ahsan
This is an example query that should work with MySQL.

select CustomerTable.customerName, CustomerTable.customerId,
count(TransactionTable.transactionId)
from CustomerTable, TransactionTable
where CustomerTable.customerId = TransactionTable.customerId
and DATE_SUB(CURDATE (), INTERVAL 30 DAY) <= TransactionTable.timeOfCreation
group by CustomerTable.customerId

Jason Weathersby
BIRT PMC


"Ahsan Hundal" <ahundal@research.telcordia.com> wrote in message
news:453b7d904ba78366d7708abe53f0454c$1@www.eclipse.org...
> Sorry for being a bit ambiguous. Let me clarify to you exactly what i want
> to do. The customers table has a list of the customers names and the
> customer ids. Customer Table:
> customerId customerName
>
> Now in the transaction table there is customer id and then transaction
> id alongwith the time it was created.
> Transaction Table:
> transactionId customerId timeOfCreation
>
> So what I have to do is to display the customer name and then with the
> customers name i need to display the number of transactions he made within
> the last day or month. They should be in sync. this should be the HTML
> table
>
> CustomerName #ofTransactions
>
> I hope now things wud be more clear.
> I would appreciate ur help again and thanks for ur responses.
> Best regards
> ahsan
>
Previous Topic:Examples
Next Topic:BIRT logging
Goto Forum:
  


Current Time: Wed Jul 23 04:34:51 EDT 2025

Powered by FUDForum. Page generated in 0.06974 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top