Page 1 of 1

Set parameter in code

Posted: Thu Apr 02, 2015 4:49 pm
by rafaelwithoeft
Hello, how i set parameters to report in the code?
Now i have this, but not work...

Code: Select all

report.Compile();
report.dictionary.variables["@sql"] = new StiVariable("@sql", parametros); 
//report["@sql"] = parametros;
report.Render(false);
Best Regards

Re: Set parameter in code

Posted: Fri Apr 03, 2015 6:54 am
by Alex K.
Hello,

Please describe your task in more details. Which parameters you are want set - variable, parameters for the query?
Also please clarify which version are you are use?

Thank you.

Re: Set parameter in code

Posted: Mon Apr 06, 2015 11:32 am
by rafaelwithoeft
Hello, i'm using Reports.FX for JAVA 2014.3, i want to set the value of variables and parameters to SQL, how i do it? (You make me a sample?)
I have variable named @sql, i want to send the sql to this variable to use in sql.

I have used this code, but not worked

Code: Select all

report.Compile();
report.dictionary.variables["@sql"] = new StiVariable("@sql", parametros); 
//report["sql"] = parametros;
report.Render(false);
Best Regards

Re: Set parameter in code

Posted: Mon Apr 06, 2015 12:44 pm
by Vadim
Hello.
For JAVA you can use next code:

Code: Select all

report.getDictionary().getVariables().get(variableName).setValue(value);
report.getVariables().put(variableName, value);
report.Render(false);
rafaelwithoeft wrote:Hello, i'm using Reports.FX for JAVA 2014.3, i want to set the value of variables and parameters to SQL, how i do it? (You make me a sample?)
I have variable named @sql, i want to send the sql to this variable to use in sql.

I have used this code, but not worked

Code: Select all

report.Compile();
report.dictionary.variables["@sql"] = new StiVariable("@sql", parametros); 
//report["sql"] = parametros;
report.Render(false);
Best Regards

Re: Set parameter in code

Posted: Mon Apr 06, 2015 1:47 pm
by rafaelwithoeft
Thank you! It Worked!

Re: Set parameter in code

Posted: Tue Apr 07, 2015 4:17 am
by Andrew
Hello,

Great!
We are always glad to help you!