Generating fields by SQL query

I want to generate fields in my report that match a certain condition, for example:

1. I've got a survey with ID 40

2. I want to select all "question_name" values from table "questions", where "survey_id" = 40

How can I do that? I assume that my "question_name" values are fields I need to display in my Detail band, but where do I put the SQL query that will enable me to do so? Do I use parameters/variable for this?

jack w.'s picture
122
Joined: Nov 9 2017 - 2:41am
Last seen: 5 years 10 months ago

1 Answer:

This could be a starting point: https://community.jaspersoft.com/documentation/tibco-jaspersoft-studio-u...

The documentation also provides information about parameters/variables.

narcism's picture
6476
Joined: Nov 22 2010 - 12:39am
Last seen: 9 hours 47 min ago

Hi narcism, thanks for an answer.

I've already read this article and tried to create a field this way, but after I click "OK" nothing happens. So, after following the instructions, I suppose I have "registered" the field. But why doesn't it appear in the Fields list? How am I supposed to use it in my report?

jack w. - 5 years 10 months ago

Maybe you are getting an error on the Dataset and Query Dialog that prevents you from reading the fields. You need to check the top left corner of the dialog for errors after pressing the "Read Fields" button.

narcism - 5 years 10 months ago
Feedback