Jump to content
We've recently updated our Privacy Statement, available here ×

fetch value from a query with several rows


olehenrik

Recommended Posts

Hi,

 

I have problem, or havent found a solution how to fetch one value/field from a query which return several rows.

 

Example - The query is like this

 

item_code value

1 A

2 B

3 C

4 D

5 E

 

I would like to use all of this values in the same band in a sentence, how can I do that? Is there a expression that can be used?

Yes I can rewrite the query so it only return one row with all the values, but it's not a good solution --> runtime would go up.

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

olehenrik wrote:

Hi,

I have problem, or havent found a solution how to fetch one value/field from a query which return several rows.

Example - The query is like this

item_code value
1 A
2 B
3 C
4 D
5 E

I would like to use all of this values in the same band in a sentence, how can I do that? Is there a expression that can be used?
Yes I can rewrite the query so it only return one row with all the values, but it's not a good solution --> runtime would go up.
Link to comment
Share on other sites

Run the query in a subreport.

 

In the subreport concatenate the strings together to form a single string and return that as a return value from the subreport. You will need to use a variable to do this, using a variable calculation value like

 

($V{Variable} == null) ?

$P{FieldValue} :

$V{Variable} + $F{FieldValue}

 

I have attached a sample jrxml subreport that I use ina similar situation. Take a look at how the SerialNumber variable is being calculated.

 

Echo [file name=subPackingListSerial.jrxml size=10233]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/subPackingListSerial.jrxml[/file]

Post edited by: Echo, at: 2007/03/02 22:36

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...