Cannot print passed parameter value

Stimulsoft Reports.PHP discussion
gegar
Posts: 31
Joined: Thu Dec 27, 2018 5:12 pm

Cannot print passed parameter value

Post by gegar »

Hello

I can made this and is working-> SELECT * FROM {Variable1}

But I want to print or view in text expresion {Variable1} not working?

Expression in Text property of 'Text1' can't be evaluated! [object Object]

Why?

Thank you for you answer.
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Cannot print passed parameter value

Post by HighAley »

Hello.

It should work right.
Could you send us a sample report template?

Thank you.
gegar
Posts: 31
Joined: Thu Dec 27, 2018 5:12 pm

Re: Cannot print passed parameter value

Post by gegar »

Hello

I have the filter for the database in $_SESSION["variable1"] the name for the company in $_SESSION["company"]

In handler.php I set the values to

$event->parameters["variable1"] = $_SESSION["variable1"];
$event->parameters["company"] = $_SESSION["company"];

I work with SELECT * FROM table WHERE {Variable1} is OK

But the header Band, i want to see the name of Company, Address and other values.

I have a field, ExpressionText {company}

I think those parameters are only for the data sources and if so, where I configure so that I can take them as a field for the header band.

Thank you.
Lech Kulikowski
Posts: 6254
Joined: Tue Mar 20, 2018 5:34 am

Re: Cannot print passed parameter value

Post by Lech Kulikowski »

Hello,

Please send us your report for analysis

Thank you.
gegar
Posts: 31
Joined: Thu Dec 27, 2018 5:12 pm

Re: Cannot print passed parameter value

Post by gegar »

Hello

Here my report

Table
DROP TABLE IF EXISTS `trademarks`;
CREATE TABLE IF NOT EXISTS `trademarks` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`Trademark` varchar(255) DEFAULT NULL,
PRIMARY KEY (`ID`)
) ENGINE=MyISAM AUTO_INCREMENT=13 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `trademarks`
--

INSERT INTO `trademarks` (`ID`, `Trademark`) VALUES
(1, 'BMW'),
(2, 'Cadillac'),
(3, 'Dodge'),
(4, 'Ford'),
(5, 'GMC'),
(6, 'Jaguar'),
(7, 'Lexus'),
(8, 'Mercedes-Benz'),
(9, 'Nissan'),
(10, 'Rolls-Royce'),
(11, 'Toyota');
COMMIT;

*************************************
handler.php

/// Filter only by Ford is working
$event->parameters["Variable1"] = "'Ford'";
/// Company Name
$event->parameters["Company"] = "'Company Ford'";

Thank you.
Attachments
trademark.mrt
(15.93 KiB) Downloaded 202 times
Lech Kulikowski
Posts: 6254
Joined: Tue Mar 20, 2018 5:34 am

Re: Cannot print passed parameter value

Post by Lech Kulikowski »

Hello,

Please try to add your Company variable to the dictionary.

Thank you.
gegar
Posts: 31
Joined: Thu Dec 27, 2018 5:12 pm

Re: Cannot print passed parameter value

Post by gegar »

Hello

I don't understand.
I tried the following:

1- In report design, I made new variable

Name: Ncomp
Init: Expresion
Expression: {Company}

It does not work.

My new question too is, How I see my Filter in my Report.

I want to see in the header.

Trademark Filter: Ford <--{Variable1} Company : Company Ford <--{Company}

Can you please explain in more detail an example if possible.

Thank you
gegar
Posts: 31
Joined: Thu Dec 27, 2018 5:12 pm

Re: Cannot print passed parameter value

Post by gegar »

Hello

I have it. The partial solucion is:

In desing create the variable with same name company
The attachment variable.jpg is no longer available
And put the next code in viewer.php and designer.php

// Load and show report
Stimulsoft.Base.Localization.StiLocalization.setLocalizationFile("localization/en.xml", true);
var report = new Stimulsoft.Report.StiReport();
report.loadFile("reports/reportname.mrt");

/// New Code for update company variables
report.dictionary.variables.getByName("company").valueObject="Company 123";

viewer.report = report;

And that is, the variable is ready for the report.
Variable Company
Variable Company
variable.jpg (53.38 KiB) Viewed 14726 times
Thank you.
Last edited by gegar on Thu Jan 17, 2019 1:04 pm, edited 1 time in total.
Lech Kulikowski
Posts: 6254
Joined: Tue Mar 20, 2018 5:34 am

Re: Cannot print passed parameter value

Post by Lech Kulikowski »

Hello

We are always glad to help you!

Thank you.
gegar
Posts: 31
Joined: Thu Dec 27, 2018 5:12 pm

Re: Cannot print passed parameter value

Post by gegar »

New Question????
Now I want to create the new variable for code: ????

This solution not work.

// Load and show report
Stimulsoft.Base.Localization.StiLocalization.setLocalizationFile("localization/en.xml", true);
var report = new Stimulsoft.Report.StiReport();
report.loadFile("reports/report.mrt");

report.dictionary.variables.getByName("company").valueObject="Company 123";

// New variable Address
var variables = new Stimulsoft.Report.Dictionary.StiVariable();
variables.name = "Address";
variables.alias = "Address";
variables.type = Stimulsoft.System.StimulsoftStringList;
variables.requestFromUser = false;
variables.value = "123456789";

viewer.report = report;

viewtopic.php?f=18&t=56088&p=149110&hil ... de#p149110


Where I find the complete code to create it by php, I have tried some solutions but they do not work???



Someone have the code for create variable in .

Thanks.
Last edited by gegar on Fri Jan 18, 2019 2:53 pm, edited 1 time in total.
Post Reply