Sources

Last modified by superadmin on 24.01.2017

The sources or rather data sources are lodged as text in the format CSV, JSON or XML and can be worked up through the Xima® Formcycle Designer/the form.
To have an access to data sources in the script area via javascript too, all data sources are converted into a JSON structure and customized in the object XFC_METADATA.urls.datasource_[csv|json|xml]. The structure of this JSON structure for the different data sources is expounded in the respective section.

CSV

Here you can insert data sets in the CSV format.

  • Choose the option CSV under type.
  • Assign an explicit name.
  • Insert the data sperated with a comma in the arrey value.
The JSON structure of the CSV data source. To this JSON structure can only be accessed via XFC_METADATA.urls.datasource_[csv|json|xml].

Example for a CSV data source

The CSV data are converted to a JSON object internally, so that the first line of the CSV data always defines the object names for the later access.
Value 1.1, value 1.2, value 1.3, value 1.4, ...

The readout of the values in the Xima® Formcycle Designer ensues through the servlet with the namen datenquellecsv.

Servlet parameters

Servlet-URL
http(s)://<server>/formcycle/datenquellecsv?mandantName=<Mandant-Name>&name=<Datenquellen-Name>

At an access of the Xima® Formcycle Designer always use the global variables object XFC_METADATA, see also global designer variables. For example it can be accessed as follows: XFC_METADATA.urls.datasource_csv.

The following parameters are possible:

name of the parameterdescriptionnecessary
nameMust match the name of the CSV data source.Yes
mandantNameMust match the name of the client under which the data source was created.Yes, if projektId is not given.
projektIdMust match the ID of the form. These information can be recalled via XFC_METADATA.currentProject.id.Yes, if mandantName is not given.
kopfzeileIndicates a comma seperated list with column name of the CSV table. If this is not given, the first line of the CSV is used.No
spaltenNamenIndicates a comma seperated list of the column, which columns are redelivered of the servlet with the corresponding value. At this, according to using, the names of the columns of the parameter headline or the name of the first line of the CSV databaseHierbei are expected.No
csvTrennzeichenIndicates the seperator between the single data cells. If this is not set, a comma , is used by default.No
csvQuoteThe seperator with which the values of the lines are seperated. If this is not set, a inverted comma " is used by default. No

Application example

An example of how a CSV datasource can look. The columns are seperated through commas.
title,first name,last name,plz,location
Herr,Max,Mustermann,1000,Musterhausen
Frau,Monika,Mustermann,2000,Musterdorf
Frau, Luise,Musterfrau,3000,Musterstadt

In the Xima® Formcycle Designer the following script is used in the script area.

$.getJSON( XFC_METADATA.urls.datasource_csv + "?name=Demo&mandantName=xima.de", function( json ) {
   var obj = json.returnValue[0]

    $('[name=tfAnrede]').val(obj.anrede)
    $('[name=tfVorname]').val(obj.vorname)
    $('[name=tfName]').val(obj.nachname)
    $('[name=tfPLZ]').val(obj.plz)
    $('[name=tfOrt]').val(obj.ort)
 })

This example as a data source for the Xima® Formcycle Designer for downloading.

Exeption selection element

The connection of a data source to a selection element takes place directly in the Xima® Formcycle Designer

If the CSV data source has to be loaded directly in a selection element, this happens via through the properties of the selection element in the Xima® Formcycle Designer.

The content of the CSV data source is processed in a selection element.

visible value, assigned value, optional value, optional valuesichtbarer wert, ...

If more than the visible and the assigned value are indicated, so optional values, the can be invoked in Javascript through the following jQuery selector.

$('[name=sel2]').find('option:selected').attr('col0');

Every optional value is stored to the selection element as attribute col + index of the optional value. At e.g. three optional values, there would be col0, col1 and col2.

XML

The XML data source acts analogously to the CSV data source, but cannot be bound to a selection element.

The JSON structure of the XML data source. To this JSON structure can than be accessed to XFC_METADATA.urls.datasource_[csv|json|xml] via Javascript.

Example for an XML data source

<root>
 <person>
   <anrede>
      Herr
   </anrede>
   <vorname>
      Max
   </vorname>
   <nachname>
      Mustermann
   </nachname>
 </person>
  <person>
   <anrede>
      Frau
   </anrede>
   <vorname>
      Monika
   </vorname>
   <nachname>
      Musterfrau
   </nachname>
 </person>
</root>

Servlet parameter

Servlet-URL
http(s)://<server>/formcycle/datenquellexml?mandantName=<Mandant-Name>&name=<Datenquellen-Name>

If you access from the Xima® Formcycle Designer, always use the global variable object XFC_METADATA, see also global designer variables. For example it can be accessed as follows: XFC_METADATA.urls.datasource_xml.

The following parameter are possible:

Parameter nameDescriptionNeccessary
mandantNameMust match the name of the client under which this data source was created.Yes
nameMust match the name of the CSV data source.Yes

JSON

The JSON data source acts analogously to the CSV data source, but cannot be bound to a selection element directly.

The JSON structure of the JSON data source. It is identically equal to the JSON data source. This JSON structure can be accessed via Javascript through XFC_METADATA.urls.datasource_[csv|json|xml].

Example for a JSON data source

{"person":[
   {
   'anrede':'Herr',
 'vorname':'Max',
   'nachname':'Mustermann'
 },
   {
    'anrede':'Frau',
    'vorname':'Monika',
   'nachname':'Musterfrau'
    }
]}

Servlet-Parameter

Servlet-URL
http(s)://<server>/formcycle/datenquellejson?mandantName=<Mandant-Name>&name=<Datenquellen-Name>

At an access from the Xima® Formcycle Designer always use the global variable object XFC_METADATA, see also global designer variables. For example you can access as follows: XFC_METADATA.urls.datasource_json.

The following parameter are possible:

ParameternameDescriptionNeccessary
mandantName Must match the name of the client under which this data source was created.Yes
name Must match the name of the CSV data source.Yes
Tags:
Created by superadmin on 02.06.2015
Translated into en by superadmin on 15.07.2016
  
Copyright 2000-2016