ronedog Posted May 1, 2010 Share Posted May 1, 2010 How can I assign a value to a variable, then use that variable throught the report. For example, I tried:Inside the variable expression I put "$V{cat_id} = SELECT cat_id FROM category WHERE category_name = "bob"But this gives me a syntax error.I want to use the variable $V{cat_id} in the report in the SQL part....or simply throughout parts of the report...Is this even possible?Thanks. Link to comment Share on other sites More sharing options...
slow Posted May 3, 2010 Share Posted May 3, 2010 yes, it's possible but I think you're in mistake in defining your variable...can you be more clear?in your variable expression you must set:"SELECT cat_id FROM category WHERE category_name = 'bob' "but this don't mean that $V{cat_id} is a result value of the query... but it's only equals to the string "SELECT cat_id FROM... "you must create a query , select your cat_id and you have its value in a Field... and the assign it to a variable if it can solve something. ____________________________________if it works... give me KARMA points please! : ) ____________________________________ Post Edited by slow at 05/03/2010 07:32 Link to comment Share on other sites More sharing options...
ronedog Posted May 6, 2010 Author Share Posted May 6, 2010 that worked, thanks Link to comment Share on other sites More sharing options...
josipmedic Posted April 21, 2014 Share Posted April 21, 2014 I haveing problem with executing query for assig to variable purpose. I now how to da it to table but not to variable. Can you please provide me short code sample , part from jrxml file. THanks, Josip Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now