Page 1 of 1
ToQueryString Report Problem
Posted: Thu Mar 15, 2018 6:41 am
by minggus
i have been work around with this ToQueryString(); report and i'm still facing a problem with the php code
i'm using this php code in my viewer to show the report.
Code: Select all
StiVariable var1 = report.dictionary.variables.getByName("Variable1");
var1.DialogInfo.Keys = new string[] {"1", "2", "3"};
var1.DialogInfo.Values = new string[] {"111","222","333"};
LongList list = new LongList();
list.AddRange(new long[] {1,2,3});
report.CompiledReport["Variable1"] = list;
viewer.report = report;
viewer.renderHtml("viewerContent");
in my report i already put Variable1 as the variable with string and value as the type.
but i'm still have error in my view report
"Uncaught SyntaxError: Unexpected identifier" in this line
StiVariable var1 = report.dictionary.variables.getByName("Variable1");
where i do wrong in my code???
thank you
Re: ToQueryString Report Problem
Posted: Fri Mar 16, 2018 8:30 am
by Alex K.
Hello,
Please check the following code:
Code: Select all
var newVariable = new Stimulsoft.Report.Dictionary.StiVariable();
newVariable.name = "Variable";
newVariable.alias = "Variable";
newVariable.type = Stimulsoft.System.StimulsoftStringList;
newVariable.requestFromUser = true;
var di = new Stimulsoft.Report.Dictionary.StiDialogInfo();
di.allowUserValues = false;
di.keys = ["1", "2", "3", "4"];
di.values = ["1", "2", "3", "4"];
newVariable.dialogInfo = di;
report.dictionary.variables.add(newVariable);
designer.onPreviewReport = function (args) {
args.report.setVariable("Variable", ["1", "4"]);}
Thank you.
Re: ToQueryString Report Problem
Posted: Fri Mar 16, 2018 9:53 am
by minggus
thank you mr. Alex but i still have an error on the php view
Code: Select all
Uncaught ReferenceError: designer is not defined at viewerDynamic.php:176
designer.onPreviewReport = function (args) {
here my full code :
Code: Select all
var options = new Stimulsoft.Viewer.StiViewerOptions();
options.appearance.fullScreenMode = true;
options.toolbar.showSendEmailButton = true;
var viewer = new Stimulsoft.Viewer.StiViewer(options, "StiViewer", false);
// Process SQL data source
viewer.onBeginProcessData = function (event, callback) {
<?php StiHelper::createHandler(); ?>
}
// Manage export settings on the server side
viewer.onBeginExportReport = function (args) {
<?php //StiHelper::createHandler(); ?>
//args.fileName = "MyReportName";
}
// Process exported report file on the server side
/*viewer.onEndExportReport = function (event) {
event.preventDefault = true; // Prevent client default event handler (save the exported report as a file)
<?php StiHelper::createHandler(); ?>
}*/
// Send exported report to Email
viewer.onEmailReport = function (event) {
<?php StiHelper::createHandler(); ?>
}
// Load and show report
var report = new Stimulsoft.Report.StiReport();
//report.loadFile("reports/"+"<?php echo $reportname?>"+".mrt");
report.loadFile("reports/ReportDynamicSQLqueries.mrt");
report.dictionary.databases.getByIndex(0).connectionString = '<?=$connStr?>';
var newVariable = new Stimulsoft.Report.Dictionary.StiVariable();
newVariable.name = "Variable1";
newVariable.alias = "Variable1";
newVariable.type = Stimulsoft.System.StimulsoftStringList;
newVariable.requestFromUser = true;
var di = new Stimulsoft.Report.Dictionary.StiDialogInfo();
di.allowUserValues = false;
di.keys = ["1", "2", "3", "4"];
di.values = ["1", "2", "3", "4"];
newVariable.dialogInfo = di;
report.dictionary.variables.add(newVariable);
designer.onPreviewReport = function (args) {
args.report.setVariable("Variable1", ["1", "4"]);}
viewer.report = report;
viewer.renderHtml("viewerContent");
Re: ToQueryString Report Problem
Posted: Tue Mar 20, 2018 5:55 am
by Lech Kulikowski
Hello,
Sorry for the misunderstanding, Alex provides code for the designer.
Please try to check the following code:
Code: Select all
...
report.dictionary.variables.add(newVariable);
report.setVariable("Variable", ["1", "4"]);
...
viewer.report = report;
viewer.renderHtml("viewerContent");
Thank you.
Re: ToQueryString Report Problem
Posted: Mon Mar 26, 2018 4:11 am
by minggus
Lech Kulikowski wrote:Hello,
Sorry for the misunderstanding, Alex provides code for the designer.
Please try to check the following code:
Code: Select all
...
report.dictionary.variables.add(newVariable);
report.setVariable("Variable", ["1", "4"]);
...
viewer.report = report;
viewer.renderHtml("viewerContent");
Thank you.
Great,
this is the right solution
thank you mr. Lech
Re: ToQueryString Report Problem
Posted: Mon Mar 26, 2018 6:19 am
by Lech Kulikowski
Hello
We are always glad to help you!
Please let us know if you need any additional help.
Thank you.
Re: ToQueryString Report Problem
Posted: Mon Mar 26, 2018 9:12 am
by minggus
Lech Kulikowski wrote:Hello
We are always glad to help you!
Please let us know if you need any additional help.
Thank you.
Sorry , but i facing new problem my report only show when i pass only one on my array, and when i pass more than one value inside my array
my report not showing any data.
this my report parameter varibale1
and this my query
where do i made something wrong??
thankyou
Re: ToQueryString Report Problem
Posted: Wed Mar 28, 2018 6:38 am
by Lech Kulikowski
Hello,
Please send us a sample report with test data which reproduces the issue for analysis.
Also, please check which query sends to the database server.
Thank you.