Skip to content

Collection and Array parameter #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
LMoota opened this issue Jun 22, 2016 · 24 comments
Closed

Collection and Array parameter #3

LMoota opened this issue Jun 22, 2016 · 24 comments

Comments

@LMoota
Copy link

LMoota commented Jun 22, 2016

I'm trying to pass as a given parameter of type array and my parameter is an ArrayList, also tried as collectible.
In CMD always says:
Parameter of type "java.util.Collection" with value x is not supported.
I tried several possible ways.
Can anyone help me?


Eu estou tentando passar como um determinado parâmetro, meu parâmetro é um ArrayList , também tentei como Collection.
Em CMD sempre diz :
Parâmetro do tipo " java.util.Collection " com o valor x não é suportado.
Eu tentei várias maneiras possíveis .
Alguém pode me ajudar?

@LuCristiana
Copy link

Estoy intentando enviar parámetros al ireport, pero no funciona... Helpme

@LuCristiana
Copy link

I'm trying to send parameters to ireport, but does not work ... Help Me

@geekcom
Copy link
Member

geekcom commented Aug 1, 2016

try updating the library composer update

@geekcom geekcom closed this as completed Aug 17, 2016
@gilvannfilho
Copy link

@geekcom vc pode me passar um exemplo passando uma collection ou array para o ireport?

@geekcom geekcom reopened this Dec 8, 2016
@geekcom
Copy link
Member

geekcom commented Dec 8, 2016

olá @gilvannfilho, o que exatamente você precisa?, forneça mais detalhes...

@gilvannfilho
Copy link

gilvannfilho commented Dec 8, 2016

@geekcom preciso passar uma collection ou array por parâmetro a partir do seu pacote e montar o details do relatório

@gilvannfilho
Copy link

@geekcom vc tem alguma novidade?

@geekcom
Copy link
Member

geekcom commented Dec 9, 2016

opa @gilvannfilho , você pode passar parâmetros usando o array específico para isso, é bem simples observe o trecho de exemplo completo abaixo:

you can use the parameter using the specific array for this, it's quite simple note the full sample excerpt below:

$jasper = new JasperPHP;

$input = '/your_input_path/your_report.jasper';   
$output = '/your_output_path';
$extension= 'pdf';
$locale = 'pt_BR';

$jasper->process(
    $input,
    $output,
    $extension, 
    [
        'parameter_1' => 'title',
        'parameter_2' => 'name',
    ],
    [
        'driver' => 'postgres',
        'username' => 'DB_USERNAME',
        'password' => 'DB_PASSWORD',
        'host' => 'DB_HOST',
        'database' => 'DB_DATABASE',
        'schema' => 'DB_SCHEMA',
        'port' => '5432'
     ],
    $locale
)->execute();

@geekcom
Copy link
Member

geekcom commented Dec 9, 2016

Outra coisa @gilvannfilho , no jasper studio ao editar ou criar seu relatório .jrxml você deve "capturar" o valor do parâmetro passado no array da seguinte forma:

Another thing @gilvannfilho, in jasper studio when editing or creating your .jrxml report you must "capture" the value of the parameter "passed" in the array as follows:

 $P{parameter_1}, $P{parameter_2} ....

@isaacbatista
Copy link

isaacbatista commented Dec 12, 2016

@geekcom existe um jdbc para sql server??? como faço pra instala-lo no pacote??? Somente encontrei o MySQL e PostGress.
Estou tentando aplicar o exemplo que vc recomendou o @gilvannfilho usar.


@geekcom is there a jdbc for sql server ??? How do I install it in the package ??? I just found MySQL and PostGress.
I am trying to apply the example you recommended the @gilvannfilho use.

@geekcom
Copy link
Member

geekcom commented Dec 12, 2016

@isaacbatista, existe sim nesse link você acha.


@isaacbatista,
Yes you can download here, this is pt_BR version

@isaacbatista
Copy link

@geekcom apos baixar esse arquivo basta coloca-lo na pasta "/vendor/geekcom/src/JasperStarter/jdbc/"???
Ou necessito instalar???

@geekcom
Copy link
Member

geekcom commented Dec 12, 2016

@isaacbatista, nesse caso você precisa "criar" uma conexão JDBC


@isaacbatista, in which case you need to "create" a JDBC connection

@isaacbatista
Copy link

@geekcom PODES ME ENSINAR COMO?

@geekcom
Copy link
Member

geekcom commented Dec 12, 2016

@isaacbatista, qual o ambiente que você tem aí?

@geekcom
Copy link
Member

geekcom commented Dec 12, 2016

me adicione no skype que te mostro como fazer>>> danielrodrigueslima

@isaacbatista
Copy link

LINUX UBUNTU

@geekcom
Copy link
Member

geekcom commented Dec 12, 2016

baixe o Jasper Studio aqui , depois crie uma conexão JDBC nele, a partir dai fica tudo muito fácil.

@isaacbatista
Copy link

isaacbatista commented Dec 12, 2016

@geekcom aqui na empresa é bloqueado o Skype, teriamos que nos falar mais tarde quando chegar em casa... outra coisa... já possuo o Jasper Studio onde produzi o jrxml com um Data Adapter com o JDBC SQL.
Qual seria o próximo passo?

@geekcom
Copy link
Member

geekcom commented Dec 12, 2016

@isaacbatista , ao que parece você já tem tudo que precisa em seu ambiente, basta gerar seu relatório, observe aqui, o array que tem os dados de conexão "monta" a conexão com o jdbc, com isso você não precisa se preocupar, outra coisa que você pode fazer é checar o comando que está sendo gerado é dá um print() no método output(), assim você pode ver o comando que está sendo gerado.

require __DIR__ . '/vendor/autoload.php';

use JasperPHP\JasperPHP;    

$input = '/your_input_path/your_report.jasper';   
$output = '/your_output_path';
$format = 'pdf';
$locale = 'en';

$jasper = new JasperPHP;

print $jasper->process(
        $input,
        $output,
        $format,
        [],
        [
            'driver' => 'postgres',
            'username' => 'DB_USERNAME',
            'password' => 'DB_PASSWORD',
            'host' => 'DB_HOST',
            'database' => 'DB_DATABASE',
            'schema' => 'DB_SCHEMA',
            'port' => '5432'
        ],
        $locale
)->output();

@isaacbatista
Copy link

@geekcom meu amigo, fiz tudo que me pediste, porém, continuo com o mesmo problema. Mas agora tenho algumas msgs novas dos erros.
Quando printei o método "output()" pude ver o comando executado:
#the_command: "./jasperstarter --locale pt_BR process "/home/vagrant/Projetos/PHP/Laravel/sim-web/public/report/municipios_inSQL.jrxml" -o "/home/vagrant/Projetos/PHP/Laravel/sim-web/public/report/1481571002_Municipios" -f pdf -t generic -u sim_con -p sim_con -H 10.10.10.155 -n sim6teste --db-port 1433 --db-driver com.microsoft.sqlserver.jdbc.SQLServerDriver --db-url jdbc:sqlserver://10.10.10.155:1433;databaseName=sim6teste --jdbc-dir /vendor/geekcom/phpjasper/src/JasperStarter/jdbc/"

Então resolvi executá-lo na console:
vagrant@homestead:~/Projetos/PHP/Laravel/sim-web/vendor/geekcom/phpjasper/src/JasperStarter/bin$ ./jasperstarter --locale pt_BR process "/home/vagrant/Projetos/PHP/Laravel/sim-web/public/report/municipios_inSQL.jrxml" -o "/home/vagrant/Projetos/PHP/Laravel/sim-web/public/report/1481570522_Municipios" -f pdf -t generic -u sim_con -p sim_con -H 10.10.10.155 -n sim6teste --db-port 1433 --db-driver com.microsoft.sqlserver.jdbc.SQLServerDriver --db-url jdbc:sqlserver://10.10.10.155:1433;databaseName=sim6teste --jdbc-dir /vendor/geekcom/phpjasper/src/JasperStarter/jdbc/
Error filling reportError executing SQL statement for: sql. --jdbc-dir: command not found

Então, resolvi retirar o --jdbc-dir /vendor/geekcom/phpjasper/src/JasperStarter/jdbc/ e executar novamente e tive esse erro:
vagrant@homestead:~/Projetos/PHP/Laravel/sim-web/vendor/geekcom/phpjasper/src/JasperStarter/bin$ ./jasperstarter --locale pt_BR process "/home/vagrant/Projetos/PHP/Laravel/sim-web/public/report/municipios_inSQL.jrxml" -o "/home/vagrant/Projetos/PHP/Laravel/sim-web/public/report/1481570522_Municipios" -f pdf -t generic -u sim_con -p sim_con -H 10.10.10.155 -n sim6teste --db-port 1433 --db-driver com.microsoft.sqlserver.jdbc.SQLServerDriver --db-url jdbc:sqlserver://10.10.10.155:1433;databaseName=sim6teste
Error filling reportError executing SQL statement for: sql.

Bom, dai eu não tive mais nenhuma luz... Será que vc já passou por isso?

@geekcom
Copy link
Member

geekcom commented Dec 13, 2016

@isaacbatista, esse erro é gerado por algum problema na sintaxe da sua query, Error executing SQL statement, mas de qualquer forma verifique se o arquivo jdbc para o mssql está no caminho indicado:
--jdbc-dir /vendor/geekcom/phpjasper/src/JasperStarter/jdbc/, depois revise suas querys em busca de algum erro, uma boa sugestão é você "rodar" sua consulta em em algum SGBD, você está no caminho certo e próximo de resolver esse problema, tente e me fale o que aconteceu.


This error is generated by some problem in the syntax of your query, Error executing SQL statement, but in any case verify that the jdbc file for mssql is in the indicated path:
--jdbc-dir /vendor/geekcom/phpjasper/src/JasperStarter/jdbc/, then review your querys for some error, a good suggestion is you "run" your query in some DBMS, you're on the way Sure and close to solving this problem, try and tell me what happened.

@isaacbatista
Copy link

@geekcom vamos ver no Skype mesmo... Te adicionei!

@geekcom
Copy link
Member

geekcom commented Dec 15, 2016

Hey @isaacbatista to close this issue follows the final solution, it's ok and tested:

$input = __DIR__ . '/input/MSSQL.jrxml';
$output = __DIR__ . '/output';
$format = 'pdf';
$locale = 'pt_BR';

$jdbc_dir = __DIR__ . '/vendor/geekcom/phpjasper/src/JasperStarter/jdbc/';

$jasper = new JasperPHP;

$jasper->process(
        $input,
        $output,
        $format,
        array(),
        [
            'driver' => 'generic',
            'host' => '127.0.0.1',
            'port' => '1433',
            'database' => 'DBName',
            'username' => 'userName',
            'password' => 'password',
            'jdbc_driver' => 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
            'jdbc_url' => 'jdbc:sqlserver://127.0.0.1:1433;databaseName=DBName',
            'jdbc_dir' => $jdbc_dir
        ],
        $locale
    )->execute();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants