Till now , Visible Columns
are not passed,where Value Columns
are passed to Jrml File in Jasper.
To answer you question There is a way to print the visible column values.
It can be done using Sub-queries, by using 'Value Column' passed to the JRML file.
Then add the subquery to your main query and it`s done!!
In the above scenario You can display
- State Name
SELECT States.STATE_NAME from States WHERE state_id = $P{STATE_ID}
- If it is Single Select input control
SELECT GROUP_CONCAT(States.STATE_NAME) from States WHERE state_id = $X{IN,state_id,STATE_ID}
- If it is Multi-Select input control
- Country Name
SELECT Country.COUNTRY_NAME from COUNTRY WHERE country_id= $P{COUNTRY_NAME}
- If it is Single Select input control
SELECT GROUP_CONCAT(Country.COUNTRY_NAME) from COUNTRY WHERE country_id = $X{IN,state_id,STATE_ID}
- If it is Multi-Select input control
Suppose this your main query where Country and State are missing..
SELECT
`id`,
`product-id`,
`name`,
`description`,
`branch`,
`stock`,
`price`
FROM
`products`
WHERE
`name` LIKE "%car%"
The modified query will looks like..
SELECT
`id`,
`product-id`,
`name`,
`description`,
`branch`,
`stock`,
`price`,
(SELECT States.STATE_NAME from States WHERE state_id = $P{STATE_ID}) as state,
(SELECT Country.COUNTRY_NAME from COUNTRY WHERE country_id=P{COUNTRY_NAME}) as country
FROM
`products`
WHERE
`name` LIKE "%car%"