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>
<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 < 0 or mes < 0 then fech=Cint(year(now)-year(this("FECHANAC"))-1) else fech=cint(year(now)-year(this("FECHANAC"))) end if if fech < 0 then msg=msg+"Fecha introducida Incorrecta"+chr(13)+chr(10) else if fech < 18 then msg=msg+"Usted Es menor de edad"+chr(13)+chr(10) end if end if end if if msg<>"" 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>