¡Esta es una revisión vieja del documento!


Aquí se podrán poner todas y cada una de las acciones que se han explicado en la parte de acciones.

Su ámbito es a nivel de coll, como el resto de eventos.


Este evento se ejecuta cuando alguien entra a editar un objeto de una colección, justo antes de que se pinten los controles en pantalla, el mismo debe ser editado por el usuario de la aplicación, es decir, si se edita un objeto mediante código, script, no se ejecuta este nodo, es un evento de usuario.


Asignamos el valor 0 a la bandera “MAP_BANDERA” y se comprueba si hay recibos, dando mensaje error si los hubiera.

<before-edit>
<action name="runscript">
	<include file="todo1_recibos.vbs"/>					
	<script language="VBScript">			
		This("MAP_BANDERA")=0
		CheckRecibosPendientes
		If This("MAP_NOPAGA")=1 Then
			AppData.FailWithMessage -8100,"El Cliente tiene recibos pendientes."
		End If													
	</script>				
</action>
</before-edit>



Ejecución de script. En este ejemplo busca si hay llamadas para un cliente en una fecha determinada.

<action name="runscript">
	<script language="VBScript">
		dim c
		set c=appdata.GetCollection("Llamadas")
		c.filter="IDCLIENTE=" + CSTR(this("ID")) + " AND FEMISION&gt;='" + cstr(This("FEMAIL")) + "'"
		c.Startbrowse
 
		//En caso de que haya, se rellenará la bandera "MAP_LLAMADAS"
		if not c.currentItem is nothing then
			this("MAP_LLAMADAS")=1
		end if
		c.EndBrowse
	</script>
</action>		


Se comprueba el usuario para asignarle los permisos que le correspondan.

<action name="runscript">
	<script language="VBScript">
		if this("TRIDUSUARIO")&lt;&gt;AppData.CurrentUser("ROWID") then
			this("MAP_DISABLE")=1
		else
			if this("ESTADO")="3" then
				this("MAP_DISABLE")=0
			else
				if this("ACTUALIZADO")=1 then
					this("MAP_DISABLE")=1
				else
					this("MAP_DISABLE")=0
				end if
			end if
		end if
	</script>
</action>


Se lanza pantalla de confirmación.

<script language="VBScript">
	if This("IDSPGMCIERRE") =0 then
		ok=AppData.UserInterface.MsgBox ("¿Continuará con la resolución de la avería?","ATENCION!",4)
		If ok=6 Then
			' ha dicho si
			This("MAP_INDTERMINA")=0
		else
			' ha dicho no
		    	This("MAP_INDTERMINA")=1
		end if
	end if
</script>