{{indexmenu_n>1}} ====== Programming Templates ====== \\ =====Code that browses a full collection===== \\ \\ \\ \\ In last versions of the platform it is just **Filter**, which will have the filter that currently has applied the collection, linkfilter it is not interpreted anymore. (**Filter** replaces **Linkfilter**) \\ =====Browsing a collection/content with few data===== \\ \\ =====Getting an object (row) from a collection, having the value of a field of such object===== \\ 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 \\ =====Getting an object (row) from a collection, using a SQL with more than a field (FINDOBJECT)===== \\ AppData.PushValue objLoquesea lanza un objeto en edición. 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 \\ =====Showing messages by screen===== \\ We have several ways to show a message on screen.\\ \\ ^ Command ^ Description ^ | ui.MsgBox "Ejemplo", "Mensaje", 0 | "ordinary" message of the framework, to disappear, the user must press the OK button. | | ui.ShowNotification 1, “Título”, “Mensaje” | Notification at the top bar of notifications, an ID is specified (1) if we want to modify the notification further on, we can use the same command with another message and the one that already did exist will be modified. | | ui.DismissNotification 1 | It deletes the Notification from the top bar of notifications by making with the "ShowNotification", we have to specify the ID (1) of the notification to specify the message we want to remove. | | ui.ShowToast "A new message has been received " | TOAST Message of the operative system, see the screenshot below. The message disappears automatically after a couple of seconds on screen. | \\ **Example of code:**\\ \\ \\ =====Asking data to be able to work with them===== \\ '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 \\ This section in the new platforms (Android, Iphone, Windows Phone...) is already **DEPRECATED** \\ =====Showing error by screen===== \\ \\ =====Types of errors===== \\ \\ =====Data validation using PopValue and PushValue for the errors===== \\ Prevent it from being saved a record with fields with some values, such as the empty ones.\\ **Appdata.PopValue** it is to take the fail value of the rule, to give it later with **Appdata.PushValue** . It will be passed like a Long, from there the Clng.\\ \\ \\ =====Button with Script===== \\ CODE TO MAKE A BUTTON. \\ \\ It is made up of **3 nodes**:\\ \\ |**Node 1** | **Prop of type "B" (button)**| It is the node that defines the place where the same title comes up, and which node it calls to execute its code. It has the METHOD attribute that is the one that makes the call to the node that has its code, the name "ExecuteNode", is the name of the "method" name, and it has to be called in the same way (uppercase-lowercase).| |**Node 2** |**method Node** name="ExecuteNode"| It is a mandatory and fixed node. (IT IS NOT ANYMORE NECESSARY, only in old frameworks).| |**Node 3** |**Node in which the code that is going to be executed is put**.| The name is defined by the user, and as only requirement, it is the node name, it has to be called in the same way (uppercase-lowercase) than the node to which the button node calls to in its method attribute.| \\ \\ =====Collection of notices===== \\ COLLECTION OF NOTICES. \\ \\ =====Image Content===== \\ CONTENT IN IMAGE MODE.\\ \\ With this content all the data will be displayed as an image, and the user, in certain coordinates of it, will be entitled to set marks.\\ \\ By making a click in that mark, it will show the data relative to it, it would be like giving a row of a regular content.\\ \\ We must keep in mind that the example is to display a vehicle in a first image, and if we press any place of it, that could be a wheel, a glass or a door, they come up some types of damages that such part of the vehicle may have.\\ \\ TWO CONTENT IN A HEADING COLL. The first one is the type-image content, that has the attributes:\\ \\ * **viewmode**: TO INDICATE THAT THE CONTENT IS SEEN IN IMAGE MODE * **imgbk**: IT IS SAID THE IMAGE DISPLAYED \\ The other content is the one that is put below and according the place where the image content is marked, the relative data will come up.\\ \\