User Tools

Site Tools


en:wiki:2.-desarrollo-app:2.3.-codigo:c.-eventos:3.-insert:start



INSERT Node


Node in which the rules and actions of saving in a collection are going to be established.

It is executed when we try to save an object. First, it will be validated that all the required values ​​have been correctly entered (beforeaction) and then, if we want, we can carry out some post-saved action.


If the saving is successful, the actions defined with the type “action” will be executed.

The format is the following one:

<insert>
 
	<!-- Formato de una acción previa a la grabación -->
	<beforeaction atributos>
		...
		Aqui hacemos las validaciones ANTES de grabar el objeto
		...
	</beforeaction >
 
	<!-- Formato de una acción de grabación -->
	<action atributos>
		...
		Aqui ya se ha grabado el objeto
		...
	</action>
 
</insert>

Example of Code


<insert>
	<!-- Acciones antes de la grabación / VALIDACIONES -->
 
	<beforeaction name="runscript">
 
         <script language="VBScript">
			Dim msg,fech,mes,dia
			msg=""
			if this("FECHANAC") is nothing then
				msg=msg+"Fecha nacimiento Vacio "+chr(13)+chr(10)
			else
				dia=Cint(day(this("FECHANAC"))-day(now))
				mes=Cint(Month(this("FECHANAC"))-Month(now))
				if  dia &lt; 0 or mes &lt; 0 then
					fech=Cint(year(now)-year(this("FECHANAC"))-1)
				else
					fech=cint(year(now)-year(this("FECHANAC")))
				end if
				if fech &lt; 0 then
					msg=msg+"Fecha introducida Incorrecta"+chr(13)+chr(10)
				else
					if fech &lt; 18 then
						msg=msg+"Usted Es menor de edad"+chr(13)+chr(10)
					end if
				end if	      			
			end if
	      		if msg&lt;&gt;"" then
	      			Appdata.FailWithMessage -8100,msg	      		
	      		end if	      		
		</script>
        </beforeaction>
 
 
	<!--Acciones de grabación -->
 
 
	<!-- Asignará el valor del "ID" del objeto actual en el campo "IDDOCUMENTO" de sus líneas del content "DetallesTotal" -->
 
	<action name="link" coll="DetallesTotal" field="IDDOCUMENTO" value="##ID##"/>
 
</insert>


en/wiki/2.-desarrollo-app/2.3.-codigo/c.-eventos/3.-insert/start.txt · Last modified: 2017/11/28 13:50 by patricia