2 data in 1 report

Stimulsoft Reports.PHP discussion
Post Reply
simbawave
Posts: 9
Joined: Sun Jan 17, 2021 3:47 am

2 data in 1 report

Post by simbawave »

hi stimulsoft,

i have a problem for showing report using 2 tables.
here is my designer
2 Table 1 Report-1.jpg
2 Table 1 Report-1.jpg (623.44 KiB) Viewed 3965 times
and here is the preview. it works good as expected on preview mode.
2 Table 1 Report-2.jpg
2 Table 1 Report-2.jpg (345.55 KiB) Viewed 3964 times
and here is the index.php code

Code: Select all

<?php
require_once "stimulsoft/helper.php";
?>
<!DOCTYPE html>

<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title>payrolltransferbank.mrt - Viewer</title>
	<link rel="stylesheet" type="text/css" href="css/stimulsoft.viewer.office2013.whiteblue.css">
	<script type="text/javascript" src="scripts/stimulsoft.reports.js"></script>
	<script type="text/javascript" src="scripts/stimulsoft.reports.maps.js"></script>
	<script type="text/javascript" src="scripts/stimulsoft.viewer.js"></script>

	<?php
		$options = StiHelper::createOptions();
		//harus dimodif gini biar bisa terima parameter
		$options->handler = "handler.php?kodepr=".$_GET["kodepr"];
		$options->timeout = 300;
		StiHelper::initialize($options);
	?>
	<script type="text/javascript">
		function Start() {
			Stimulsoft.Base.StiLicense.loadFromFile("license.key");

			var report = Stimulsoft.Report.StiReport.createNewReport();
			report.loadFile("reports/payrolltransferbank.mrt");

			var options = new Stimulsoft.Viewer.StiViewerOptions();
			var viewer = new Stimulsoft.Viewer.StiViewer(options, "StiViewer", false);

			viewer.onBeginProcessData = function (args, callback) {
				<?php StiHelper::createHandler(); ?>
			}

			viewer.report = report;
			viewer.renderHtml("viewerContent");
		}
	</script>
</head>
<body onload="Start()">
	<div id="viewerContent"></div>
</body>
</html>
and here is the handler.php code

Code: Select all

<?php
require_once "stimulsoft/helper.php";

// Please configure the security level as you required.
// By default is to allow any requests from any domains.
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Engaged-Auth-Token");

$handler = new StiHandler();
$handler->registerErrorHandlers();

$handler->onBeginProcessData = function ($args) {
	if ($args->connection == "MyDB")
		$args->connectionString = "Server=localhost;Database=glory2a;Uid=root;";

		//$args->parameters["kodepr"] = "IND-GRY2-HRD111201117103";
	//di bawah ini tambahan manual. biar bisa terima GET dan HARUS DICOPY SQL QUERY di sini biar bisa populate
	$args->parameters["kodepr"] = $_GET["kodepr"];
	$args->queryString="select*from rekapgajiview where kodepr='{kodepr}'
and (statusstaf='F' or statusstaf='B')
and (tglkeluar is null or tglkeluar>tglakhir)
and not (norek is null)";

	return StiResult::success();
	
	$args->queryString="select*from profilepabrik";
};

$handler->process();
the result after publishing in web server, the 2nd query is not executed.
2 Table 1 Report-3.jpg
2 Table 1 Report-3.jpg (285.21 KiB) Viewed 3964 times
please kindly give me a clue what to do to execute the 2nd query.

thanks
Lech Kulikowski
Posts: 6163
Joined: Tue Mar 20, 2018 5:34 am

Re: 2 data in 1 report

Post by Lech Kulikowski »

Hello,

Please send us a sample that reproduces the issue for analysis.

Thank you.
simbawave
Posts: 9
Joined: Sun Jan 17, 2021 3:47 am

Re: 2 data in 1 report

Post by simbawave »

here is my mrt file
payrolltransferbank.mrt
(47.5 KiB) Downloaded 220 times
and here is the index.php and handler.php, i put them into 1 rar file (compressed)
payrolltransferbank.rar
(1.39 KiB) Downloaded 216 times
simbawave
Posts: 9
Joined: Sun Jan 17, 2021 3:47 am

Re: 2 data in 1 report

Post by simbawave »

probably you might need the sql and some data to reproduce the case?
here i attach for those 2 tables.
profilepabrik.rar
(379 Bytes) Downloaded 216 times
rekapgajiview.csv
(606.09 KiB) Downloaded 212 times
many thanks :)
simbawave
Posts: 9
Joined: Sun Jan 17, 2021 3:47 am

Re: 2 data in 1 report

Post by simbawave »

to make it easy to understand, i have 2 queries from 1 datasource (database).
1 is placed in databand, another 1 is in page header.

in the designer, preview mode, i can see both queries are executed very well.
but after i publish, i can only see the query in the databand is executed while the query in the page header didn't get executed.
probably i have to add something in handler.php or anything.

please kindly give me a clue about what to do

thanks :)
Lech Kulikowski
Posts: 6163
Joined: Tue Mar 20, 2018 5:34 am

Re: 2 data in 1 report

Post by Lech Kulikowski »

Hello,

We need some additional time to investigate the issue, we will let you know about the result.

Thank you.
Post Reply