{{indexmenu_n>3}} ===== Relations between collections ===== \\ In XOne there are three types of relations between collections: \\ ^ TYPE OF RELATION ^ VISUAL REPRESENTATION ^ DESCRIPTION ^ | Relation from 1 to 1 (Magnifying Glass) | {{wiki:control_linked.png}} | Used in relations with collectins that have many data.| | Relation from 1 a 1 (Combo) | {{wiki:control_combo.png}} |Used in relations with collections with little data.| | Relation from 1 to Several (Contents) | {{wiki:control_content.png}} |Used when we don´t know the number of logs we can associate. A tipical example of contents are the Orders and its details. | ===== Relation 1 to 1: Magnifying Glass===== \\ This kind of relation is used to select a unique value from another collection. \\ \\ In Database only will be saved the IDE of the selected row, being able to rescue, besides, just to show on screen, another fields of the selected row.\\ \\ \\ ^ Link field view of magnifier type in Pocket PC ^ | {{wiki:relaciones-colecciones:vista-lupa-pda.png}} | ^ Link field view of magnifier type in BlackBerry ^ | {{wiki:relaciones-colecciones:vista-lupa-bb.png}} | Cliente Contacto ===== Relation 1 to 1: Combo ===== \\ It is similar than the previous one, but it is used only when the collection called has little data. \\ \\ This is important, because when the edition window is going to be painted, and one the fields has a combo, it will load in memory all the values that this combo can contain, so if there are many data to be loaded at the time to open that editing window, it may take a long time.\\ \\ \\ ^ Link field view of magnifier type in Pocket PC ^ | {{wiki:relaciones-colecciones:vista-combo-pda.png}} | ^ Link field view of magnifier type in BlackBerry ^ | {{wiki:relaciones-colecciones:vista-combo-bb.png}} | === Example of Code === Tipo The difference with the magnifier type is just the **showinline="true"** attribute and besides the fact that the combo is loaded with values when entering in the collection unlike the magnifier.\\ ===== Relation 1 to 1: Combo but WITHOUT AUXILIARY DATABASE ===== \\ The structure is similar than the previous ones, but it is used exclusively when the collection called has little data and clearly defined. \\ IT IS NOT executed a table in Database, the values are defined in a first PROP and are rescued in another PROP. === Example of Code === \\ ===== Relation 1 to N: Contents ===== \\ A contents collection is a group of data that depend on a header, that is, a collection that depends on another. \\ \\ It is used when we do not know the number of logs we are going to be able to associate in the header collection. \\ \\ Tipical examples of contents are the orders and its details lines or items and its stocks. \\ \\ \\ {{wiki:relaciones-colecciones:vista-contents-pda.png}} \\ ^ Link field between the header and the details collection(contents) ^ | {{wiki:relaciones-colecciones:relacion-contents.png}} | \\ To define collection with content it is necessary to follow several steps:\\ \\ ===== Steps to create a content ===== ==== Step 1 ==== \\ The main collection must be defined (e.g. documents collection). Each one of the properties defined in this collection correspond to the object header. \\ \\ It is defined the content collection.\\ \\ In the example we are using, a collection of document details will be created. Each one of the properties defined in this collection will correspond to the detail lines of the document. \\ In the main collection a content definition is included. The content definition has the following format:\\ **prop** * **name:** It assigns a name to the property. It is usual to put an "@" in front to indicate that is a property which makes reference to a content. We recommend its use to distinguish and locate easily within the mappings. * **group:** Group or tab where the content will appear. * **type:** Type of property. To refer to a content it has to be "Z". * **contents:** Content name. This attribute makes a call to the contents node that has its same name. That is, the contents attribute has to be the same than the name of the contents node. * **width:** It defines the content width. * **height:** It defines the content height. In Android, is possible to modify this attribute by script. Let´s suppose that for instance you need a search box that is hidden and that you enables it with a button, and you want that everything takes always the 100% of the screen. So, what you would do would be the following: