This translation is older than the original page and might be outdated.

Inclusion of Files

Mobility apps created with XOne have two main files: appwizard.xml and mappings.xml, but, there are several ways to include files with calls, in such way that we can have external code to better control its creation.

The different ways to make a call to an external file are:

As we have already seen, it can be inserted xonescript code inside the actions to make our job.
But we do not have to insert directly that code inside the XML, but in many occasions is convenient to put it on an external file, in such way that only when such a code is called, it is parsed, so the app performance gets better.

These files that have xonescript code, must have VBS extension.

The realization of the inclusion of these files is as follows:

<coll name="Empresas" title="la empresa" 
      sql="SELECT e.* FROM ##PREF##Empresa e" objname="Empresa" updateobj="Empresa" progid="ASGestion.CASEmpresa" sort="CODIGO" fontsize="10">
      <group name="General" id="1">
      <prop name="IDMONEDA" visible="0" type="N" mapcol="Monedas" mapfld="ID"/>
      <include file="funciones.vbs" language="VBScript" />
      <include file="time.vbs"/>
      <include file="\include\function.vbs"/>
      <include file="\include\calendario.vbs"/>

As said before, instead of loading it at start in the companies collection, it can be loaded at the moment we are going to need it, for instance:

<action name="runscript">
	<include file="funciones_terminar.vbs"/>
		<script language="VBScript">
			  appdata.failwithmessage -11888,"##EXIT##"

On the other side, the machinery allows to have XML code into another files, with what we could have collections in external files.

In order to be able to make these steps, it would be as follows:

The mappings.xml file must exists and it is mandatory, and it is the main file to be searched, and this one will be the one that will later make the calls to the files with external collections.
For this, to a coll level the ext-file attribute is set, where this attribute allows to include complete collections from xml external files.
The value of the attribute defines the name and extension so that a definition of a collection is included from an external file.

The name attrubute of the coll node where is defined, must match with the same attribute in the collection described in the file.

The external file must have a single node of collection, that is, only has to exist the coll node.

In recent versions of the platform it is not necessary to specify the ext-file, if the collection doesn´t exist in the mappings, you should try to find an XML file with the same name of the collection, at the same folder where the mappings is in.

<coll name="prueba" ext-file="prueba.xml" />

The machinery allows to have declared CSS the definition of certain features of the nodes. To do this, it will be necessary to have external CSS file which have the code that we are going to use later.

The call to this file it will be made inside the app node,and with the style node. Here, an example is shown:

<app prefix="Gen" version="" companycolor="#FF8000,#FF4000" forecolor="#FFFFFF>
       <logon showalways="true" finduser="true" replica="true"></logon>
       <style url="default.css" />

This code is clearly defined in this place: CSS