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



ACTION Node


Node where the actions to be performed will be displayed in the events defined in our application.

The name of the action defines what it will perform.


It consists of assigning a value to a property of the object. You can use macros in the value attribute.

	<!-- Ponemos la ID de la empresa del usuario que se ha logueado en IDEMPRESA -->
	<action name="setval" field="IDEMPRESA" value="##ENTID##" />
 
	<!-- Se pueden utilizar MACROS, en este caso ##FLD_NOMBRE## que tendría el valor del campo NOMBRE del objeto actual 
	     OJO porque por ejemplo en un create esta macro NO TENDRIA VALOR -->
	<action name="setval" field="MAP_CUENTA" value="##FLD_NOMBRE##" />
 
	<!-- Ponemos la fecha actual del sistema y la ponemos en el campo FECHA -->
	<action name="setval" field="FECHA" value="##NOW##" />
 
	<!-- Cogemos el ID del usuario del sistema y lo ponemos en IDUSUARIO-->
	<action name="setval" field="IDUSUARIO" value="##USERID##" />
 
        <!-- Ponemos a 0 el campo EXECUTED y a 1 el campo IDCARGO -->
	<action name="setval" field="EXECUTED" value="0" />
	<action name="setval" field="IDCARGO" value="1" />


Attribute Description
name Name of the action to execute
field Field to be updated
value Value that will be assigned to the field


Execution of XOneScript code within our application. In this case, it does not have any attributes, but it does have a node where the script will be executed, as shown in the example below.


	<!-- Cogemos el valor del campo MAP_SERIE y concatenamos con "/" y el campo NUMERO y lo ponemos en NUMCOMPLETO -->
	<action name="runscript">
		<script language="VBScript">
			This("NUMCOMPLETO")=This("MAP_SERIE") + "/" + CStr(This("NUMERO"))
		</script>
	</action>
 
	<!-- Podemos llamar a un fichero de scripts cuando lo necesitemos, la funcion EntrarN estara definida en funciones.vbs -->
	<action name="runscript">
		<include file="funciones.vbs" />
		<script language="VBScript">
			EntrarN
		</script>
	</action>



To take a value from a field in the father collection and put it in a field of the daughter collection. Used in the contents.

Although this action keeps working, currently is in disuse, since practically everything is made by script. The instruction to assign/ get a value from your “father” collection is:

  1.- In vbscript:   this("NOMBRE")=this.OwnerCollection.ownerobject("MAP_DELPADRE") 
  2.- In javascript: self.NOMBRE=self.getOwnerCollection().getOwnerObject().MAP_DELPADRE;
	<!-- Cogemos el valor del ID de la colección padre y lo ponemos en el campo IDCLIENTE de la colección Contents -->
		<action name="setfldval" targetfld="IDCLIENTE" sourcefld="ID"/>


Attribute Description
name Name of the action to execute
targetfld Field to be updated with the father's field
sourcefld Field of the father collection that will give value to the field of this collection


We look for a value in another collection and we bring the value of some field.

	<!-- Buscamos en la colección Usuarios el registro cuyo ID sea el el usuario logueado actualmente 
	     y cogemos el valor del campo IDSERIE para ponerlo en el campo IDSERIE de la colección actual, es decir: 
	     IDSERIE = "SELECT IDSERIE FROM gen_usuarios WHERE ID=##USERID##". -->
	<action name="mapval" field="IDSERIE" targetfld="IDSERIE" coll="Usuarios" mapfld="ID" mapvalue="##USERID##" />
 
	<!-- Buscamos en la colección TiposUsuario el registro cuyo CODIGO = 4 
	     y cogemos el valor del campo ID para ponerlo en el campo IDTIPO de la colección actual, es decir: 
	     IDTIPO = "SELECT ID FROM gen_tiposusuario WHERE CODIGO=4"  -->
	<action name="mapval" field="IDTIPO" targetfld="ID" coll="TiposUsuario" mapfld="CODIGO" mapvalue="4" />
 
	<!-- Buscamos en la colección Usuarios el registro cuyo ID sea el el usuario logueado actualmente 
	     y cogemos el valor del campo LOGIN para ponerlo en el campo CODTECNICO de la colección actual, es decir: 
	     CODTECNICO = "SELECT LOGIN FROM gen_usuarios WHERE ID=##USERID##". -->
	     <action name="mapval" field="CODTECNICO" targetfld="LOGIN" coll="Usuarios" mapfld="ID" mapvalue="##USERID##" />


Attribute Description
name Name of the action to execute
field Field to be updated
targetfld Name of the field that has the value that will be assigned to the field field
coll Collection where the search of the field that will have the required value is going to be made
mapfld Field of the collection defined in the coll attribute, that is the first key of it
mapvalue Value of the first key field to rescue the log searched


To execute an SQL sentence, Insert, Update or Delete. It does not make sense to execute a Select, because the action does not return any value.

Very used in header collections, when you are deleting a record, it deletes all its associated lines.

	<!-- Se pueden utilizar MACROS -->
	<action name="executesql" sql="DELETE FROM ##PREF##DetParte WHERE IDPARTE=##ID##" />


Attribute Description
name Name of the action to execute.
sql SQL sentence that you want to execute. Only is valid the Insert, Update or Delete execution.


To update the link field of a detail collection with the ID of the header.

Used EXCLUSIVELY in the INSERT node of a header collection. To link the detail lines of the CONTENTS collection when the header and details are being registered at the same time, because until the header is not recorded, the detail lines do not know what the ID of their father is.

Currently, although this method obviously continues to work automatically to update the IDENLACE with the header in the details (contents, subgrid or whatever you want to call it …) once the header is recorded, this node is in disuse and practically everything is controled by script and it is the programmer who makes the data association, header-details.

However, the framework internally continues trying to find a link field between the contents and the collection “header” where they are included in. To avoid this behavior, in the contents collection, at the COLL level, you must specify the check-owner=“false” and dependent=“false” attributes.

<action name="link" coll="Detalles" field="IDDOCUMENTO" value="##ID##" />


Attribute Description
name Name of the action to execute
coll Collection searched to update the link field with this Father collection
field Name of the field of the collection with the name that is defined in the coll attribute and that is the link with this collection Father
value Value assigned to the link field between the Father collection and the daughter collection

NODO BEFOREACTION


Node where the actions to be performed will be displayed in the events defined in our application, being able to execute each and every one of the types of actions available in the action node .
However, as an important point to keep in mind, this action is only valid for the Insert event, and it is used to validate fields, in case it gives error, the object won´t be saved and the user is forced to insert a value for the validated field. .