Use of terminate() method

Grettings,I have a table “Consulta”, when I insert a new record, I call a JasperReport with in a .php script.

1st. Problem:The report shows correctly in the self tab, but i want to show in a new browser tab (_bank), and in the self shows the list page.This is my code: Server Events → Table-Specific → Common → Row_Inserted

$this->terminate("JasperPHP/rptreceta.php?consulta=".$rsnew["id"]);

2nd Problem:The table has a 3 details table, “receta”, “imagenes”,“examenes”. Every detail have a report pdf. I need to shows 3 reports in 3 _blank page browser.I try to use 3 senetences terminate.This is my code: Server Events → Table-Specific → Common → Row_Inserted

$this->terminate("JasperPHP/rptatencion.php?consulta=".$rsnew["id"]);
$this->terminate("JasperPHP/rptreceta.php?consulta=".$rsnew["id"]);
$this->terminate("JasperPHP/rptimagen.php?consulta=".$rsnew["id"]);

But only shows the first.Thanks.Omar

onoboa wrote:

But only shows the first.

Indeed. After calling a terminate method, then the code after/below that line will not be executed.

PHP is server side, the terminate() should only be called once when the page is fully executed. It cannot open a new tab in your browser which is client side. You may try to output tags with target=“_blank” (it still depends on how your browser opens a new page) and then click them by JavaScript in Startup Script.

Thaks for your answer, i see this post

https://discourse.hkvstore.com/t/target-blank-open-menu-links-on-new-tab/4047/5 resolve my 1st problem:Client Script-> Table-Specific → Edit Page → Startup Script

/* id is the name of my link field */
$('id').attr('target','_blank');

I resolve my second problem:1.- No use terminte in Server Event-> Table Specific-> Common-> Row_Inserted.2.- Use a Hyperlink field (for my case the field ID).
HREF Field: id
Original field value: (checked)
Target: _blank
Prefix: JasperPHP/rptconsulta.php?consulta= (my external .php file)3.- Content of rptconsulta.php

<?php

	//Envia a imprimir los reportes relacionados a la Consulta Medica por medio de su Id de Consulta
	$consulta = $_GET["consulta"];
	$url = "http://localhost:8089/hrmedic/JasperPHP/rptatencion.php?consulta=" . $consulta;	
	echo "<SCRIPT>window.open('$url', '_blank');</SCRIPT>";
	$url = "http://localhost:8089/hrmedic/JasperPHP/rptreceta.php?consulta=" . $consulta;	
	echo "<SCRIPT>window.open('$url', '_blank');</SCRIPT>";
	$url = "http://localhost:8089/hrmedic/JasperPHP/rptimagen.php?consulta=" . $consulta;	
	echo "<SCRIPT>window.open('$url', '_blank');</SCRIPT>";
	$url = "http://localhost:8089/hrmedic/JasperPHP/rptlaboratorio.php?consulta=" . $consulta;	
	echo "<SCRIPT>window.open('$url', '_blank');</SCRIPT>";
	echo "<SCRIPT>window.close();</SCRIPT>";
?>

Question:How change “http://localhost:8089/” for my hosting server dynamicly.Thanks

Just remove this part from your code:http://localhost:8089/hrmedic/or if it does not work, try the following one instead:http://localhost:8089/

You may remove http://localhost:8089.