This report is include external jar in jasper studio, when i run in jasper running as expected then nothing error produce, but if i compile this on laravel it's generate Error filling reportError loading scriptlet class.
I had see in jaspersoft my external.jar only have path within name like class=external.jar, i reverse engineering .jasper file, there is no clue how to whether jasperstarter or php access this external jar library
Jasper studio : Referenced library
/Users/me/Documents/GitHub/myproject/storage/app/file/jasper/external.jar
Detail on my jrxml:
<scriptlet name="Scriptlet_1" class="external">
<scriptletDescription><![CDATA[]]></scriptletDescription>
</scriptlet>
Detail on my PHP
$folderstorage = "/app/file/jasper";
$folderassets = "/User/file/jasper";
$namef = "invoice";
$input = storage_path().$folderstorage."/".$namef.".jasper";
$output = storage_path().$folderstorage;
$options = [
'format' => [$ext2],
'locale' => 'en',
'params' => ['myid'=>$id],
'db_connection' => [
'driver' => 'postgres', //mysql, ....
'username' => env("DB_USERNAME"),
'password' => env("DB_PASSWORD"),
'host' => env("DB_HOST"),
'database' => env("DB_DATABASE"),
'port' => env("DB_PORT")
]
];
if(file_exists(storage_path().$folderstorage."/".$namafile . '.' . $ext)){
unlink(storage_path().$folderstorage."/".$namafile . '.' . $ext );
}
$jasper = new PHPJasper;
$jasper->compile($input)->process(
$input,
$output,
$options
)->execute();
When run in browser then look console of my IDE: Using $input = storage_path().$folderstorage."/".$namef.".jrxml";
value = ((external)parameter_Scriptlet_1_SCRIPTLET.getValue()).calcucredit(((java.math.BigDecimal)variable_sumTotalItem.getEstimatedValue()).doubleValue()).toString().toUpperCase(); //$JR_EXPR_ID=26$
Using .jasper
Error filling reportError loading scriptlet class: calcucredit
On this project i run with:
- Laravel 6.2
- geekcom/phpjasper : 3.3
- jasper studio 6.6.0
- in external.jar project i had include jasperreports-6.7.0