Expression question

Hi

I am designing a report in Jaspersoft Studio and have data arranged in the following format

Col 1     Col 2     Col 3

data 1   data 2    data 3

data 4   data 5    data 6

What I would like some help with is in writing a query that will give me the contents of Col 3 when Col 1 = data1 and Col 2 = data 2

All fields are strings.

Would greatly appreciate some help on what might be the correct syntax.

Thanks in advance.

Tony

ozrebel's picture
22
Joined: Sep 1 2011 - 9:11pm
Last seen: 6 years 10 months ago

2 Answers:

I'm only familiar with SQL, but here's something that might help:

select Col3 from [TABLE]

where Col1 = Data1

and Col2 = Data2

 

Note that the syntax might depend on what datasource you are using.

Hope this helps!

M.B.Morgan

mbmorgan's picture
343
Joined: Apr 14 2014 - 11:15am
Last seen: 9 years 2 months ago

Thanks for the response M.B. Morgan.
I guess I didn't make myself clear enough though.
What I was really looking for was a way to write a query in the Expression editor, as I already have an sql query which has delivered data to me in the format outlined.
Would be great to know if it's possible, or whether I have to re-write the sql to deliver the data in a different manner to start with.

ozrebel - 9 years 2 months ago

Hi ,

Have you tries using PrintWhenExpression Property 

This will allow you to decide when to print the contents of Column 3 , and that would be the expression you mentioned  Col 1 = data1 and Col 2 = data 2

Do Let me know if you need further details on this resolve.

 

Thanks
Ankur Gupta 

http://ankurthetechie.blogspot.in/
 

Ankur Gupta's picture
Joined: Jan 21 2013 - 10:36pm
Last seen: 18 hours 44 min ago
Feedback
randomness