Diferencias

Muestra las diferencias entre dos versiones de la página.

Enlace a la vista de comparación

Ambos lados, revisión anterior Revisión previa
Próxima revisión
Revisión previa
wiki:2.-desarrollo-app:2.6.-demos-y-ejemplos:c.-recorrer-coleccion:start [2017/10/30 11:42] – [Validación de datos usando PopValue y PushValue para los errores] patriciawiki:2.-desarrollo-app:2.6.-demos-y-ejemplos:c.-recorrer-coleccion:start [2023/10/18 12:29] (actual) – [Código que recorre una colección completa] ary
Línea 1: Línea 1:
 +
 +{{indexmenu_n>1}}
 +====== Plantillas de Programación ======
 + 
 +
 +
 +=====Código que recorre una colección completa=====
 +
 +\\
 +\\
 +<code vb>
 +<action name="runscript">
 + <script language="VBScript">
 + Dim coll, filtro
 + ‘Variable con la coleccion que se va a utilizar
 + Set coll =AppData.GetCollection("PresupuestosScript")
 + ‘Guardamos el filtro que tiene la coleccion por defecto 
 + filtro=coll.filter
 + ‘Le ponemos un filtro con el atributo filter, 
 + ‘que machacaría el filtro que ya tiene la coll en su atributo filter.
 + coll.filter="MAP_SIMBTIPO='PR'"
 + ‘Función para ejecutar el SQL de la coll, y poder recorrer los record que tiene dicha coll
 + coll.StartBrowse
 + ‘Utilizamos un while, preguntando si el registro actual es nulo o no.
 + while not coll.CurrentItem is nothing
 + if coll.CurrentItem("OPTIONS") = 0 then
 + coll.currentItem("OPTIONS")=1
 + coll.currentItem.Save
 + end if
 + ‘Para pasar al siguiente registro de la coll
 + coll.MoveNext
 + wend
 + ‘Siempre que se hace un StartBrowse, tiene que existir un EndBrowse, que es para cerrar la conexión.
 + coll.EndBrowse
 + ‘Restauramos el filtro original
 +  coll.filter=filtro
 + Set coll=nothing
 + </script>
 +</action>
 +</code>
 +\\
 +<WRAP center round important 60%>
 +
 +
 +En las últimas versiones de la plataforma únicamente se trata **Filter**, que contendrá el filtro que tiene aplicado ahora mismo la colección, <wrap em>linkfilter ya no se interpreta</wrap>. (**Filter** <wrap em>ha pasado a sustituir a</wrap> **Linkfilter**)
 +</WRAP>
 +=====Recorrer una colección/content con pocos datos=====
 +\\
 +
 +<code vb>
 + <action name="runscript">
 + <script language="VBScript">
 + Dim colldet,j,i,valor
 + ‘Cogemos la coll contents Detalles del objeto actual This.
 + Set colldet=this.contents("Detalles")
 + j=0
 + ‘Guardamos en la variable i el número de registros que tiene el content.
 + i=this.contents("Detalles").count
 +
 + ‘Si es cero se pueden dar dos opciones:
 +         ‘ - Que no haya ningún registro
 +              ‘ - Que aún no se haya cargado el content y por eso no tengamos ningún registro
 +         ‘Así que le hacemos un loadall para cargarlos todos (si no están cargados), y si no hubiera
 +         ‘registros no pasaría nada al hacer el loadall.
 +
 + ‘El loadall cuidado con su uso, ya que si tiene muchos elementos, nos quedaremos sin memoria. 
 + ‘El máximo número de registros de una colección para cargarla con loadall podemos fijarla en 20 
 + ‘claro está, todo depende de lo grande que sea cada registro de dicha colección.
 +   if i=0 then
 +   this.contents("Detalles").loadall
 + i=this.contents("Detalles").count
 +     end if
 + ‘Utilizamos un For para recorrer los registros del contents.
 +     For j=0 to i-1
 + ‘Tomamos el valor del content con el indice de dicho registro.
 +   valor=colldet(j)("IDARTICULO")
 +     if valor="loquesea" then
 +     ‘ Realizar la función deseada
 +     end if
 +     next
 + ‘Liberamos memoria.
 + Set colldet=nothing
 + </script>
 + </action>
 +</code>
 +
 +\\
 +=====Obtener un objeto (fila) de una colección, teniendo el valor de un campo de dicho objeto=====
 +\\
 +
 +<code vb>
 + Dim obj
 + ‘Buscamos el cliente en la coll Clientes, con el valor del ID del cliente.
 + Set obj=appdata.getcollection("Clientes")("ID",CStr(This("IDCLIENTE")))
 + If not obj is nothing Then
 + obj("PROXIMA")=This("PROXIMA")
 + obj("OBSERVACIONES")=This("FICHA")
 + obj.save
 + End If
 + Set obj=nothing
 +</code>
 +\\
 +=====Obtener un objeto (fila) de una colección, utilizando una SQL con más de un campo (FINDOBJECT)=====
 +\\
 +<nowiki>AppData</nowiki>.<nowiki>PushValue</nowiki> objLoquesea lanza un objeto en edición.
 +<code vb>
 +Set cCierre=AppData.GetCollection("Cierre")
 +Set objCierre=cCierre.FindObject("NUMINCIDENCIA='"+This("NUMINCIDENCIA")+"' AND NUMPROGRESO='"+This("NUMPROGRESO")+"'")
 +If  objCierre Is Nothing Then
 + set objCierre=cCierre.CreateObject
 + objCierre("MAP_IDINCIDENCIA")=This("ID")
 + objCierre("NUMINCIDENCIA")=This("NUMINCIDENCIA")
 + objCierre("NUMPROGRESO")=This("NUMPROGRESO")
 + ContarPiezas This("NUMINCIDENCIA"),This("NUMPROGRESO")
 + objCierre("MAP_NUMPIEZAS")=This("MAP_NUMPIEZAS")
 + cCierre.additem objCierre
 + AppData.PushValue objCierre
 +Else
 + Appdata.failwithmessage -11888,"Ya ha ejecutado el cierre con anterioridad."
 +End If
 +</code>
 +=====Mostrar mensajes por pantalla=====
 +Tenemos varias formas de mostrar un mensaje en pantalla.
 +
 +^ Comando       ^ Descripción ^
 +| ui.<nowiki>MsgBox</nowiki> "Ejemplo", "Mensaje", 0     | Mensaje "normal" del framework, para desaparecer, tiene que darle el usuario al botón de OK. |  
 +| ui.<nowiki>ShowNotification</nowiki> 1, “Título”, “Mensaje”     | Notificación en la barra superior de notificaciones, se le especifica un ID (1) para si queremos modificar la notificación más adelante, podemos utilizar el mismo comando con otro mensaje y se modificará el que ya existía. |  
 +| ui.<nowiki>DismissNotification</nowiki> 1   | Elimina la Notificación de la barra superior de notificaciones realizado con el "<nowiki>ShowNotification</nowiki>", hemos de especificar el ID (1) de la notificación para especificar el mensaje que queremos quitar. | 
 +| ui.<nowiki>ShowToast</nowiki> "Se ha recibido un nuevo mensaje "   | Mensaje TOAST del sistema operativo, ver la captura de pantalla más abajo. El mensaje desaparece automáticamente tras un par de segundos en pantalla. |  
 +\\
 +**Ejemplo de código:**
 +<code xml>
 +<!-- En este caso vamos a hacer uso del nodo replica-ok, para capturar el evento de cuando recibimos operaciones en la tabla gen_mensajeria -->
 +<replica-ok-gen_mensajeria>
 + <action name="runscript">
 + <script language="VBScript">
 +
 + 'AppData.UserInterface.MsgBox hace exactamente lo mismo, ui es una abreviatura de AppData.UserInterface.
 + ui.MsgBox "Ejemplo", "Mensaje", 0
 +
 + ui.ShowNotification 1, “Título”, “Mensaje” (el primer parámetro es el ID por si hay que modificarla luego)
 +
 + ui.ShowToast "Se ha recibido un nuevo mensaje "
 + </script>
 + </action>
 +</replica-ok-gen_mensajeria>
 +
 +</code>
 +
 +=====Pedir datos para poder trabajar con ellos=====
 +\\
 +<code vb>
 + 'Con esta ventana se piden datos de tipo texto y se guardan en la variable s1.
 + s1 =appdata.userinterface.getinputstring ("Mensaje de la Ventana","Valor Ventana",0)
 + 'En esta ventana, SOLO se le pide datos de tipo numéricos y se guardan en la variable s2.
 + s2 =appdata.userinterface.getinputstring ("Mensaje de la Ventana","Valor Ventana",1)
 + s="El Presupuesto: " + cstr(s1) + " tiene el valor: " + cstr(s2)
 + 'Solo muestra mensaje
 + d=appdata.userinterface.msgbox (cstr(s),"Presupuesto",0)
 + 'Muestra un mensaje con aceptar o cancelar. Guarda en la variable a el botón pulsado.
 + a=appdata.userinterface.msgbox (cstr(s),"Presupuesto",1)
 + if a=1 then
 + ‘Entra aquí porque se le dio a Aceptar.
 + else
 + ‘Entra aquí porque se le dio a Cancelar.
 + end if
 +</code>
 +\\
 +<WRAP center round alert 60%>
 +Esta sección en las nuevas plataformas (Android, Iphone, Windows Phone...) ya está **DEPRECATED**
 +</WRAP>
 +
 +
 +=====Mostrar error por pantalla=====
 +\\
 +
 +<code vb>
 +
 +<script language="VBScript">
 +    if this("IDCLIENTE")= 0 then
 + Appdata.FailWithMessage -8100,"¡¡No ha seleccionado un cliente.!!"
 +    end if
 +    'SCRIPT PARA REALIZAR LA VALIDACION DE LOS DETALLES, QUE SE MIRA SI EL CAMPO IDTARIFA 
 +    'ESTA LLENO O NO. SI DA ERROR, MUESTRA UN MENSAJE DE TIPO -8100, PARA DECIR QUE ES ERROR.
 +    Dim i,j
 +
 +    Dim colldet
 +    Set colldet=this.contents("DetallesCabecera")
 +    j=0
 +    i=this.contents("DetallesCabecera").count
 +    if i=0 then
 +        this.contents("DetallesCabecera").loadall
 +    end if
 +    i=this.contents("DetallesCabecera").count
 +    while i &lt;&gt;
 +        valor=colldet(j)("IDTARIFA")
 +            if valor=0 then
 +                i=0
 +                aux=1   
 +            else
 +                i=i-1
 +                j=j+1
 +            end if
 +        if aux=1 then Appdata.FailWithMessage -8100,"¡¡Hay Detalles sin Tarifa!!" 
 +    wend
 +</script>
 +
 +</code>
 +\\
 +
 +=====Tipos de errores=====
 +\\
 +<code vb>
 +
 +<script language="VBScript">
 +    'ERROR DISPONIBLE EN TODAS LAS PLATAFORMAS
 +        'Muestra un mensaje de error con el texto que le pongamos
 +        appdata.failwithmessage -8100,"Mensaje de error"
 +    
 +    'ERRORES DISPONIBLES EN PLATAFORMA POCKET PC
 +        'Muestra un mensaje de error con el texto que le pongamos
 +        appdata.failwithmessage -7500,"Mensaje de warning"
 +    
 +        'Refresca la cabecera cuando se ejecuta con el Selecteditem. YA NO ES NECESARIO.
 +        appdata.failwithmessage -666,"Mensaje de información"
 +    
 +        'Mensaje de informacion con icono de Información
 +        appdata.failwithmessage -11888,"Mensaje que queremos mostrar"
 +    
 +        'Mensaje personalizado con posiblidad de bloqueo con botón.
 +        appdata.failwithmessage -11822,"Mensaje de información"
 +    
 +        'Mensaje propio de CGS
 +        appdata.failwithmessage -11811,"Mensaje de información"
 +    
 +        'Inicia la replica desde un script
 +        Appdata.FailWithMessage -8100,"##STARTREPLICA##"
 +    
 +        'Esta macro funciona conjuntamente con CGStart (kiosko de PDA). 
 +        'Cierra el frame y le dice al kiosko q reinicie la PDA. 
 +        'Si el kiosko no está instalado, simplemente se cierra la aplicación.
 +        Appdata.FailWithMessage -8100,"##RESETAPP##"
 +    
 +        'Salir de la aplicacion.
 +        Appdata.FailWithMessage -8100,"##EXITAPP##"
 +    
 +        'Usado para salir de las ventanas de Nomen y Edit.
 +        Appdata.FailWithMessage -8100,"##EXIT##"
 +</script>
 +
 +</code>
 +\\
 +
 +=====Validación de datos usando PopValue y PushValue para los errores=====
 +\\
 +Evitar que se pueda guardar un registro con campos con ciertos valores, como vacíos.\\
 +**Appdata.<nowiki>PopValue</nowiki>** es para coger el valor de fallo de la rule, para posteriormente con **Appdata.<nowiki>PushValue</nowiki>** dárselo.
 +Se le pasará como un Long, de ahí el Clng.\\
 +\\
 +
 +<code xml>
 +
 +<insert>
 +    <rule name="fail-if-not-valid">
 +        <rule name="runscript" msg="Faltan por rellenar campos obligatorios.">
 +            <script language="VBScript">
 +                Dim bFail,x
 +                x =AppData.PopValue
 +                bFail =0
 +                if This("FECHANAC") &lt;&gt; "" then
 +                    if This("DNI")&lt;&gt;"" AND bFail=0 then
 +                        bFail=0
 +            else
 +             bFail=1
 +     end if
 +     if This("PROVINCIA")&lt;&gt;"" AND bFail=0 then
 +         bFail=0
 +     else
 +         bFail=1
 +     end if
 +     if This("CALLE")&lt;&gt;"" AND bFail=0 then
 +         bFail=0
 +     else
 +         bFail=1
 +     end if
 +     if This("IDPROPIETARIO")&lt;&gt;"" AND bFail=0 then
 +         bFail=0
 +     else
 +         bFail=1
 +     end if
 +     if bfail=0 then 
 +         This("%FALTANDATOS")=0
 +     else
 +         This("%FALTANDATOS")=1
 +     end if
 + Else
 +     This("%FALTANDATOS")=1
 + end if
 + AppData.PushValue (CLng(bFail))
 +            </script>
 +        </rule>
 +    </rule>
 +</insert>
 +</code>
 +
 +\\
 +
 +=====Botón con Script=====
 +\\
 +CÓDIGO PARA REALIZAR UN BOTÓN. \\
 +\\
 +Está formado por **3 nodos**:\\
 +\\
 +|**Nodo 1** | **Prop de tipo "B" (botón)**| Es el nodo que define donde sale el mismo título y a que nodo llama para ejecutar su código. Tiene el atributo METHOD que es el que realiza la llamada al nodo que tiene su código, el nombre "<nowiki>ExecuteNode</nowiki>", es el nombre del nodo "method", y tiene que llamarse de la misma forma (mayúsculas-minúsculas).|
 +|**Nodo 2** |**Nodo method** name="<nowiki>ExecuteNode</nowiki>"| Es un nodo obligatorio y fijo. (YA NO ES NECESARIO, solo en frameworks antiguos).|
 +|**Nodo 3** |**Nodo en el que se pone el código que se va a ejecutar**.| El nombre es definido por el usuario, y como único requisito, es el nombre del nodo, tiene que llamarse igual (mayúsculas-minúsculas) que el nodo al que llama el nodo button en su atributo method.|
 +\\
 +<code xml>
 +<prop name="Iniciar" group="3" type="B" method="ExecuteNode (inicializar)" title="Iniciar Ruta" visible="1" toolbar="false" labelwidth="24"  onchange="refresh255" lmargin="7"/>
 +
 +<method name="ExecuteNode">
 + <param name="P1" type="T" value=""/>
 +</method>
 +
 +<inicializar>
 + <action name="runscript">
 + <script language="VBScript">
 + Dim vResult
 + vResult =AppData.UserInterface.MsgBox ("Esta acción reiniciará toda la ruta. ¿Está seguro que desea ejecutarla?","Advertencia",1)
 + If vResult =1 Then
 + appdata.executeSQL "UPDATE Gen_Rutas SET VISITADO=0 WHERE IDUSUARIO=" + CStr(This("IDUSUARIO"))
 + vResult =AppData.UserInterface.MsgBox ("Ruta inicializada","Advertencia",0)
 + End If
 + </script>
 + </action>
 +</inicializar>
 +</code>
 +\\
 +=====Colección Avisos=====
 +\\
 +COLECCIÓN DE AVISOS.
 +\\
 +<code xml>
 +<coll name="Avisos" title="el aviso" sql="SELECT d.ID
 + FROM (##PREF##Documentos d
 + LEFT OUTER JOIN ##PREF##TiposDocumento td ON d.IDTIPODOC=td.ID)
 + WHERE td.SIMBOLO='PD' AND d.OP1=1" objname="Documentos" updateobj="Documentos" progid="ASData.CASBasicDataObj" 
 + notify="true" notify_counter="false" notify_coll="ParteDiario" alternate-counter="true" notify_title="Entregas Avisos">
 + <group name="General" id="1"></group>
 + <prop name="ID" group="1" visible="7" type="N" fieldsize="5"></prop>
 +</coll>
 +</code>
 +\\
 +=====Content Imagen=====
 +\\
 + CONTENT EN MODO IMAGEN.\\
 + 
 +\\
 +Con este content se mostrarán los datos como una imagen, y el usuario, en ciertas coordenadas de la misma, podrá poner marcas.  \\
 +Al realizar un click en dicha marca, mostrará los datos relativos a ella, sería como dar a una línea de un content normal.\\
 +\\
 +Hay que tener en cuenta que el ejemplo es para mostrar en una primera imagen un vehículo, y si se le da a un lugar del mismo, que podrá ser una rueda, un cristal o una puerta, saldrán tipos de daños que puede tener dicha parte del vehículo. \\
 +\\
 +
 +
 +
 +DOS CONTENT EN UNA COLL CABECERA. El primero es el content de tipo imagen, que tiene los atributos:\\
 +\\ 
 +  * **viewmode**: PARA INDICAR QUE EL CONTENT SE VEA MODO IMAGEN
 +  * **imgbk**: SE LE DICE LA IMAGEN QUE SE MUESTRA
 +\\
 +El otro content es el que se pone debajo y que según el lugar donde se marca en el content imagen, saldrán los datos relativos. \\
 +
 +\\
 +<code xml>
 + <prop name="MAP_KK31-" title="Tarea Verificar. Daños" labelwidth="23" bgcolor="#CC3333" group="3" visible="0" fieldsize="8" size="8" type="TL" labelshadow="false" forecolor="#FFFFFF"/>
 + <prop name="@PLANTILLA1" group="3" visible="1" type="Z" contents="Plantilla1" viewmode="picturemap" imgbk="##FLD_MAP_IMGPLANTILLA1##" bgcolor="#FFFFFF" lines="7" onchange="Refresh" mask="2" height="40%"/>
 + <contents name="Plantilla1" src="Plantilla1" group="3" filter="t1.IDDOCPLANTILLA=##FLD_MAP_IDPLANTILLA1##" macros="##MACRO1##(##FLD_TAREAID##)" mask="2" bgcolor="#FFFFFF"></contents>
 + <button name="AntesVeh" group="3" caption="&lt;&lt;                  &gt;&gt;" visible="true" labelwidth="12" lmargin="9" onchange="Refresh" method="ExecuteNode (antesveh)" labelfont-bold="true" bgcolor="#FFFFFF" text-bgcolor-disabled="#FFFFFF"/>
 + <prop name="MAP_PLANTILLA" title="Vista:" labelwidth="0" type="T" size="150" locked="true" locking="true" newline="false" lmargin="1" showinline="true" linkedto="MAP_IDPLANTILLA1" linkedfield="DESCRIPCION" fieldsize="14" visible="0" group="3" onchange="Refresh255" labelshadow="false" forecolor="#CC3333" bgcolor="#FFFFFF" text-border-top="false" text-border-bottom="false" text-border-left="false" text-border-right="false" labelfont-bold="true" labelbox="false" labelfontsize="10" textfontsize="10" fontsize="10" text-bgcolor-disabled="#FFFFFF"/>
 + <button name="DespuesVeh" group="3" caption="&gt;&gt;" visible="false" labelwidth="4" newline="false" lmargin="1" onchange="Refresh" method="ExecuteNode (despuesveh)" labelfont-bold="true" bgcolor="#FFFFFF" text-bgcolor-disabled="#FFFFFF"/>
 + <prop name="@PDANOS1" group="3" visible="1" type="Z" contents="Danos1" lines="7" onchange="Refresh" mask="2" height="45%"/>
 + <contents name="Danos1" src="Danos1" group="3" filter="t1.SITUACION=##FLD_MAP_SITUACION##" macros="##MACRO1##(##FLD_TAREAID##)" mask="2"></contents>
 +
 +
 + <!-- COLL QUE ES EL CONTENT DE IMAGEN. TIENE QUE TENER 4 CAMPOS QUE TENDRAN LOS ATRIBUTOS PARA PINTAR LA MARCA EN EL DIBUJO QUE SE MUESTRA
 + xcoord="true": COORDENADA X
 + ycoord="true": COORDENADA Y
 + circle-radius="true": PARA INDICAR EL RADIO DEL CIRCULO DE LA MARCA
 + icon-mark="true": ICONO DE LA MARCA A PONER
 + -->
 +<coll name="Plantilla1" title="Plantilla1"
 + sql="SELECT t1.ID,t1.XCOORD,t1.YCOORD,
 + t1.RADIO,t1.SITUACION,t1.ROWID AS MAP_ROWID,
 + t2.ID AS MAP_IDMPLANTILLA,t2.CONTADOR AS MAP_CONTADOR,
 + CASE 
 + WHEN t2.CONTADOR&gt;0 THEN t1.ICONMARK 
 + ELSE '' 
 + END AS ICONMARK
 + FROM ##PREF##detplantilla t1
 + LEFT OUTER JOIN ##PREF##marcaplantilla t2 ON t1.ID=t2.IDDETPLANTILLA AND t2.TAREAID=##MACRO1##"
 + objname="detplantilla" updateobj="detplantilla" progid="ASData.CasBasicDataObj" fontsize="8" editmask="2">
 + <!-- PESTAÑAS -->
 + <group name="Puntos" id="1"></group>
 + <!-- CAMPOS VISIBLES -->
 + <macro name="##MACRO1##" value="0" default="true"/>
 + <!--  -->
 + <prop name="XCOORD" title="X COORD" xcoord="true" labelwidth="6" type="N" size="15" locked="true" locking="true" fieldsize="8" visible="7" group="1" labelshadow="false" forecolor="#CC3333" bgcolor="#CC3333" text-border-top="false" text-border-bottom="true" text-border-left="false" text-border-right="false" labelfont-bold="true" labelbox="false" labelfontsize="10" textfontsize="10" fontsize="10" text-bgcolor-disabled="#FFFFFF"/>
 + <prop name="YCOORD" title="Y COORD" ycoord="true" labelwidth="6" type="N" size="15" locked="true" locking="true" fieldsize="8" visible="7" group="1" labelshadow="false" forecolor="#CC3333" bgcolor="#CC3333" text-border-top="false" text-border-bottom="true" text-border-left="false" text-border-right="false" labelfont-bold="true" labelbox="false" labelfontsize="10" textfontsize="10" fontsize="10" text-bgcolor-disabled="#FFFFFF"/>
 + <prop name="RADIO" title="RADIO" circle-radius="true" labelwidth="6" type="N" size="15" locked="true" locking="true" fieldsize="8" visible="7" group="1" labelshadow="false" forecolor="#CC3333" bgcolor="#CC3333" text-border-top="false" text-border-bottom="true" text-border-left="false" text-border-right="false" labelfont-bold="true" labelbox="false" labelfontsize="10" textfontsize="10" fontsize="10" text-bgcolor-disabled="#FFFFFF"/>
 + <prop name="SITUACION" title="SITUACION" labelwidth="6" type="N" size="15" locked="true" locking="true" fieldsize="8" visible="7" group="1" labelshadow="false" forecolor="#CC3333" bgcolor="#CC3333" text-border-top="false" text-border-bottom="true" text-border-left="false" text-border-right="false" labelfont-bold="true" labelbox="false" labelfontsize="10" textfontsize="10" fontsize="10" text-bgcolor-disabled="#FFFFFF"/>
 + <prop name="ICONMARK" title="" icon-mark="true" labelwidth="6" type="T" size="15" locked="true" locking="true" fieldsize="8" visible="7" group="1" labelshadow="false" forecolor="#CC3333" bgcolor="#CC3333" text-border-top="false" text-border-bottom="true" text-border-left="false" text-border-right="false" labelfont-bold="true" labelbox="false" labelfontsize="10" textfontsize="10" fontsize="10" text-bgcolor-disabled="#FFFFFF"/>
 + <prop name="MAP_IDMPLANTILLA" labelwidth="6" type="N" size="15" locked="true" locking="true" fieldsize="8" visible="7" group="1" labelshadow="false" forecolor="#CC3333" bgcolor="#CC3333" text-border-top="false" text-border-bottom="true" text-border-left="false" text-border-right="false" labelfont-bold="true" labelbox="false" labelfontsize="10" textfontsize="10" fontsize="10" text-bgcolor-disabled="#FFFFFF"/>
 + <prop name="MAP_CONTADOR" labelwidth="6" type="N" size="15" locked="true" locking="true" fieldsize="8" visible="7" group="1" labelshadow="false" forecolor="#CC3333" bgcolor="#CC3333" text-border-top="false" text-border-bottom="true" text-border-left="false" text-border-right="false" labelfont-bold="true" labelbox="false" labelfontsize="10" textfontsize="10" fontsize="10" text-bgcolor-disabled="#FFFFFF"/>
 + <prop name="MAP_ROWID" labelwidth="6" type="T" size="15" locked="true" locking="true" fieldsize="8" visible="7" group="1" labelshadow="false" forecolor="#CC3333" bgcolor="#CC3333" text-border-top="false" text-border-bottom="true" text-border-left="false" text-border-right="false" labelfont-bold="true" labelbox="false" labelfontsize="10" textfontsize="10" fontsize="10" text-bgcolor-disabled="#FFFFFF"/>
 +
 + <selecteditem onchange="Refresh255">
 + <action name="runscript">
 + <script language="VBScript">
 + 'DATOS DE LA PRIMERA PESTANHA
 + this.ownerCollection.ownerObject("MAP_SITUACION")=This("SITUACION")
 + this.ownerCollection.ownerObject("MAP_IDDETP1")=This("ID")
 + this.ownerCollection.ownerObject("MAP_IDMP1")=This("MAP_IDMPLANTILLA")
 + this.ownerCollection.ownerObject("MAP_CONP1")=This("MAP_CONTADOR")
 + this.ownerCollection.ownerObject("MAP_DETIDP1")=This("MAP_ROWID")
 + //appdata.failwithmessage -666,"" YA NO ES NECESARIO!!!
 + </script>
 + </action>
 + </selecteditem>
 +</coll>
 +</code>
 +\\
 +=====Crear Registro con Script=====
 +\\
 +CREAR UN NUEVO REGISTRO CON UN SCRIPT.\\
 +\\
 +
 +El script se podrá ejecutar en un **create, insert, delete, botón**... en cualquier lugar.\\
 +<code xml>
 +<action name="histor" type="runscript">
 + <script language="VBScript">
 + 'Dimensionamos las variables
 + Dim coll,det
 + 'Cogemos en que coleccion se va a crear el nuevo objeto, con lo que tomara todas las caracteristicas del mismo, 
 + ' ejecutandose el create si lo tuviera.
 + Set coll =AppData.GetCollection("ColeccionEnLaQueSeCreaElRegistro")
 + 'Creamos el objeto
 + set det = coll.CreateObject
 + 'Lo añadimos a la coll, lanzando el create del mismo
 + coll.AddItem Empty,det
 + 'Añado los valores a los distintos campos
 + det("CAMPONUMERICO")=5
 + det("CAMPOTEXTO")="VALOR DEL CAMPO"
 + det("CAMPOFECHA")=now()
 + 'Salvo el objeto
 + det.Save
 + 'Liberamos variables.
 + set coll.clear
 + Set coll=nothing
 + Set det=nothing
 + </script>
 +</action>
 +</code>
 +\\
 +
 +===== Poner valor a una Variable Global =====
 +
 +<code vb>
 +<action name="runscript">
 + <script language="VBScript">
 + appdata.CurrentEnterprise.Variables("NoAvisar")=0
 + </script>
 +</action>
 +</code>
 +
 +=====Información Queue Dispositivo=====
 +\\
 +COLECCION QUE MUESTRA LA CANTIDAD DE DATOS QUE QUEDAN POR ENVIAR.\\
 +\\
 +
 +Esta colección se puede complicar todo lo que se quiera, incluso poniendo **Join** con otras tablas, para decir de que tabla faltan los datos
 +por enviar desde el dispositivo móvil a la central.\\
 +\\
 +
 +La tabla MASTER_REPLICA_QUEUE, solo se puede utilizar para ver datos, nunca para escribir directamente en la misma, ya que es una 
 +tabla de sistema, con la cual se enviarán los datos desde el dispositivo móvil al servidor central.\\
 +\\
 +
 +<code xml>  
 +<coll name="InformacionQueue" title="la informacion queue" 
 + sql="SELECT COUNT(ID) AS MAP_CUENTA
 + FROM master_replica_queue"
 + objname="master_replica_queue" updateobj="master_replica_queue" progid="ASData.CASBasicDataObj" forprint="false" 
 + editwidth="75" editheight="76" autorefresh="true">
 + <group name="General" id="1"/>
 + <prop name="MAP_CUENTA" visible="7" group="1" type="N" fieldsize="20" labelwidth="8" size="30">DATOS PARA ENVIAR</prop>
 +</coll>
 +</code>
 +\\
 +
 +   
 +