Skip to content

Adding example for CSV #158

Open
Open
@yuzrie

Description

@yuzrie

There's only example for json and xml, and database, it'd help to have more examples or at least the available drivers in db_connection options. I'm trying to use the library with CSV file (it works in the Jaspersoft Studio, but having trouble to run from PHPJasper).

I am wondering if the answer is inside the options like so (taking example from the xml):

$csv_file = public_path() . '/sample.csv';
$options = [
    'format' => ['pdf'],
    'params' => [],
    'locale' => 'en',
    'db_connection' => [
        'driver' => 'xml', // here uses 'csv' ? 
        'data_file' => $data_file, // here uses $csv_file?
        'xml_xpath' => '/your_xml_xpath' // and this one can be removed?
    ]
];

I tried to look into jasperstarter, csv seems to be supported. Its just I don't know how to use it because no example to refer to. I get error when trying in the terminal:

usage: jasperstarter process [-h] -f <fmt> [<fmt> ...] [-o <output>] [-w]
                     [-a [<filter>]] [-P <param> [<param> ...]]
                     [-r [<resource>]] [-t <dstype>] [-H <dbhost>]
                     [-u <dbuser>] [-p <dbpasswd>] [-n <dbname>]
                     [--db-sid <sid>] [--db-port <port>]
                     [--db-driver <name>] [--db-url <jdbcUrl>]
                     [--jdbc-dir <dir>] [--data-file <file>]
                     [--csv-first-row] [--csv-columns <list>]
                     [--csv-record-del <delimiter>]
                     [--csv-field-del <delimiter>]
                     [--csv-charset <charset>] [--xml-xpath <xpath>]
                     [--json-query <jsonquery>]
                     [--jsonql-query <jsonqlquery>] [-N <printername>] [-d]
                     [-s <reportname>] [-c <copies>]
                     [--out-field-del <delimiter>]
                     [--out-charset <charset>] <input>
jasperstarter: error: argument --csv-columns is required 

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions