Nodo BEFORE-EDIT
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>='" + 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")<>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>
<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>
<before-edit> <action name="setval" field="MAP_VERSIONAPP" value="##VERSION##" /> <action name="setval" field="MAP_VERSIONFRAME" value="##FRAME_VERSION##" /> <action name="setval" field="MAP_VERSIONXONELIVE" value="##LIVEUPDATE_VERSION##" /> <action name="setval" field="MAP_DISPOSITIVO" value="##DEVICE_MODEL##" /> <action name="setval" field="MAP_FABRICANTE" value="##DEVICE_MANUFACTURER##" /> <action name="setval" field="MAP_DEVICE_TYPE" value="##DEVICE_TYPE##" /> <action name="setval" field="MAP_IMEI" value="##DEVICEID##" /> <action name="setval" field="MAP_MID" value="##MID##" /> <action name="setval" field="MAP_ORIENTATION_SCREEN" value="##CURRENT_ORIENTATION##" /> <action name="setval" field="MAP_OS_VERSION" value="##DEVICE_OSVERSION##" /> <action name="setval" field="MAP_OS" value="##DEVICE_OS##" /> <action name="setval" field="MAP_DENSITY" value="##CURRENT_DENSITY##" /> <action name="setval" field="MAP_VEROPER" value="0" /> <action name="setval" field="MAP_RESOLUTIONWIDTH" value="##SCREEN_RESOLUTION_WIDTH##" /> <action name="setval" field="MAP_RESOLUTIONHEIGHT" value="##SCREEN_RESOLUTION_HEIGHT##" /> <action name="setval" field="MAP_DENSITY2" value="##CURRENT_DENSITY_VALUE##" /> <action name="runscript"> <script language="javascript"> self.MAP_GROUP = 1; self.MAP_TOTAL_PAGES = 7; self.MAP_ESPECIAL = 0; self.executeNode("grupos(1)"); self.MAP_RECORDSRX = replica.getRecordsRX().toString() + "/" + replica.getTotalRecordsRX().toString(); self.MAP_RECORDSTX = replica.getRecordsTX().toString() + "/" + replica.getTotalRecordsTX().toString(); self.MAP_RECORDSPEND = replica.getRecordsPend(); self.MAP_LOG = replica.getLog(); ui.executeActionAfterDelay("refresh",10); if( self.MAP_VERSIONXONELIVE == "##LIVEUPDATE_VERSION##"){ self.MAP_VERSIONXONELIVE = "No Instalado"; } if( self.MAP_MID.indexOf("'",1) > 0){ self.MAP_MID = self.MAP_MID.replace(/'/gi,""); } </script> </action> </before-edit>