¡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.


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>

Javascript

 <before-edit>
        <action name="runscript">
          <script language="javascript">
          	self.MAP_GROUP=1;
          </script>
        </action>
        <action name="runscript">
          <script language="javascript">
            self.MAP_GROUP=1;
			self.MAP_TOTAL_PAGES=2;
 
			var v=ui.getView(self);
 
            self.MAP_X=3;
            self.MAP_Y=2;
            self.MAP_X2=3.5;
            self.MAP_Y2=2.3;
 
            self.MAP_XMASY=self.MAP_X+self.MAP_Y;
            self.MAP_XMASY2=self.MAP_X+self.MAP_Y2;
            self.MAP_X2MENOSY2=self.MAP_X2-self.MAP_Y2;
            self.MAP_XENTREY=self.MAP_X/self.MAP_Y;
			self.MAP_FECHADMY=new Date();
			self.MAP_FECHAYMD=self.MAP_FECHADMY;
			self.MAP_FECHAHORA=self.MAP_FECHADMY;
 
			</script>
        </action>
      </before-edit>
 <before-edit>
        <action name="runscript">
          <script language="javascript">
		self.executeNode ("cambiarMenu('BASICO','1SELECT.png',##FLD_MAP_COLOR1##)");		
	  </script>
        </action>
      </before-edit>