Passing Parameters to SQL

Stimulsoft Reports.JAVA discussion
Vadim
Posts: 363
Joined: Tue Apr 23, 2013 11:23 am

Re: Passing Parameters to SQL

Post by Vadim »

Hello.
Can you show screenshot of added category
smartleopard
Posts: 22
Joined: Wed Apr 01, 2015 2:29 pm

Re: Passing Parameters to SQL

Post by smartleopard »

Vadim wrote:Hello.
Can you show screenshot of added category
Hi,
I've used the code below:

stiReport.getDictionary().getVariables().add(new StiVariable("Var1", "", new StiSystemGuid()));

It adds Category. See the screenshots:
2016-04-30_082920.jpg
2016-04-30_082920.jpg (50.26 KiB) Viewed 4520 times
And when I right click on it and choose Edit:
2016-04-30_083006.jpg
2016-04-30_083006.jpg (24.07 KiB) Viewed 4520 times
I'm using Stimulsoft.For.Java.Flex 2014.3

Thx
Vadim
Posts: 363
Joined: Tue Apr 23, 2013 11:23 am

Re: Passing Parameters to SQL

Post by Vadim »

Hello.
Did you use your code stiReport.getDictionary().getVariables().add(new StiVariable("Var1", "", new StiSystemGuid()));
with report.getVariables().put("Var1", val);
?
smartleopard
Posts: 22
Joined: Wed Apr 01, 2015 2:29 pm

Re: Passing Parameters to SQL

Post by smartleopard »

Vadim wrote:Hello.
Did you use your code stiReport.getDictionary().getVariables().add(new StiVariable("Var1", "", new StiSystemGuid()));
with report.getVariables().put("Var1", val);
?
Hi,
as far as I understand, the below code works as: first parameter is category name, second one is variable name and the last one is variable type.

Code: Select all

new StiVariable("Var1", "", new StiSystemGuid())
I changed my code as below:

Code: Select all

stiReport.getDictionary().getVariables().add(new StiVariable("Cat1", "Var1", new StiSystemString()))
stiReport.getDictionary().getVariables().get("Var1").setValue("JAVA");
stiReport.getVariables().put("Var1", "JAVA");
but it throws NullPointerException when serializing report before to show in flex designer 2014.3.
Vadim
Posts: 363
Joined: Tue Apr 23, 2013 11:23 am

Re: Passing Parameters to SQL

Post by Vadim »

Hello.
Now I understand, pelase use next code:

Code: Select all

report.getDictionary().getVariables().add(new StiVariable("", "Var1", StiSystemTypeEnum.SystemString.getSystemType()));
smartleopard
Posts: 22
Joined: Wed Apr 01, 2015 2:29 pm

Re: Passing Parameters to SQL

Post by smartleopard »

Vadim wrote:Hello.
Now I understand, pelase use next code:

Code: Select all

report.getDictionary().getVariables().add(new StiVariable("", "Var1", StiSystemTypeEnum.SystemString.getSystemType()));
Hi,
Thanks for your attention and response, Now it works. But there is another question in my mind:
What I must do with a report that has variables which are not requested by user when I click the Preview? By other words, when I select Preview in designer, how i must fill the variables? I mean which method is called when preview is selected that then I can fill the variables?
Thx
Vadim
Posts: 363
Joined: Tue Apr 23, 2013 11:23 am

Re: Passing Parameters to SQL

Post by Vadim »

Hello.
You can fill variables in RenderReportAction like in webfx sample my.actions.MyRenderReportAction
smartleopard
Posts: 22
Joined: Wed Apr 01, 2015 2:29 pm

Re: Passing Parameters to SQL

Post by smartleopard »

Vadim wrote:Hello.
You can fill variables in RenderReportAction like in webfx sample my.actions.MyRenderReportAction
Hi,
Thanks for your response
Andrew
Posts: 4106
Joined: Fri Jun 09, 2006 3:58 am

Re: Passing Parameters to SQL

Post by Andrew »

Hi,

Glad to help you!

Have a nice day!
Post Reply