- Main Page
- Data Structures
- Files

- File List
- Globals

# samples/jsrun_params.c File Reference

`#include <jasperserver.h>`
`#include <time.h>`

Go to the source code of this file.

## Defines
#define | MAX_INPUT_STRING 512
## Functions
jasperserver_server_t * | get_connection ()
| Get an instance of jasperserver_server_t This function instance a jasperserver_server_t struncture and fill it with some default used in the sample. It is responsability of the user free the memory used by the allocated jasperserver_server_t;.
void | print_query_result (jasperserver_resource_descriptor_t *inputcontrol, char *datasourceUri)
int | getDataType (const char *dataTypeResourceUri)
jasperserver_parameter_t * | acquire_value_for_input_control (jasperserver_resource_descriptor_t *inputcontrol, char *dsUri)
| This method shows how to render and get the value for an input control.
int | main (int argc, char **argv)
## Variables
const char | server [] = "http://127.0.0.1:8080/jasperserver/services/repository"

## Detailed Description

This sample shows how to run a report unit. In particular this sample shows how run a report unit and export it in pdf. This report unit has several input control. The sample shows how to get all the required information to render the input controls and pass the selected values to the function that will run the report.

See also:
  jasperserver_ws_runReport, jasperserver_ws_get, jasperserver_ws_list

Definition in file jsrun_params.c.

## Define Documentation

#define MAX_INPUT_STRING 512

Definition at line 36 of file jsrun_params.c.

## Function Documentation

jasperserver_parameter_t* acquire_value_for_input_control | ( | jasperserver_resource_descriptor_t * | inputcontrol,
|  | char * | dsUri |
| ) |  |  |

This method shows how to render and get the value for an input control.

The sample is not exaustive, not all the kind of input control are shown here, and there is not input validation.

Parameters:

  | inputcontrol | The inputcontrol resource.
  | dsUri | An optional datasource uri to execute a query in case of query based input control. This uri is passed here because normally it comes from the report unit (as child resource).

Returns:
  a new instance of a parameter. It is user responsability of the user free the memory for this object. Anyway, this parameter will be probably added to a resource prepared to execute the runReport service. In that case, the parameter will be freed by the function jasperserver_request_free();

Definition at line 190 of file jsrun_params.c.

jasperserver_server_t* get_connection | ( |  | ) |

Get an instance of jasperserver_server_t This function instance a jasperserver_server_t struncture and fill it with some default used in the sample. It is responsability of the user free the memory used by the allocated jasperserver_server_t;.

Returns:
  A server instance.

Definition at line 47 of file jsrun_params.c.

int getDataType | ( | const char * | dataTypeResourceUri | ) |

This method shows how to get the type of data normally linked to an input control.

Parameters:

  | dataTypeResourceUri | The URI of the datatype

Returns:
  the type of data

Possible values:

- JS_DT_TYPE_TEXT 1
- JS_DT_TYPE_NUMBER 2
- JS_DT_TYPE_DATE 3
- JS_DT_TYPE_DATE_TIME 4

Definition at line 143 of file jsrun_params.c.

int main | ( | int | argc,
|  | char ** | argv |
| ) |  |  |

Definition at line 341 of file jsrun_params.c.

void print_query_result | ( | jasperserver_resource_descriptor_t * | inputcontrol,
|  | char * | datasourceUri |
| ) |  |  |

This method shows how to print a set of records coming from a query to populate a query based input control...

Parameters:

  | inputcontrol | The input control of type JS_IC_TYPE_SINGLE_SELECT_QUERY
  | datasourceUri | The optional uri of a datasource against which execute the query on which the control is based.

Definition at line 68 of file jsrun_params.c.

## Variable Documentation

const char server[] = "http://127.0.0.1:8080/jasperserver/services/repository"

Definition at line 34 of file jsrun_params.c.