{{indexmenu_n>1}} ====== FIELD MAPPED TO ANOTHER COLLECTION ===== \\ Property of MAPPED-type\\ \\ \\ Property of type IDLINK to another collection.\\ \\ \\ Cliente Contacto \\ ==== mapcol="coleccion" | mapfld="campo" | default-mapcol="coleccion"==== \\ |**mapcol:** It indicates that this property is linked to another collection, that is, this is a key field in the relation of many to one. | \\ Example of code:\\ \\ In this example is indicated that the property which name is IDTIPO is numerci and is linked to a collection named "[[wiki:2.-desarrollo-app:2.3.-entender_un_mapping:a.-estructura_xml:5.-nodo-prop:tiposusuario]]".\\ \\ The field used to link this property to the external collection is indicated through the 'mapfld' attribute.\\ \\ This attribute value must be the name of a collection valid within the application. If the collection is not defined, the user interface may cause an error when attempting to link this property with any other.\\ \\ For this value, the macro ##OWNERCOLL## can be used by indicating we are referring to the collection in which the object owner of this object is defined in. \\ \\ If the property is declared in a collection of details of documents, the owner collection would be the collection of documents from which the contents is in. \\ \\ The data layer replaces the name of this macro when it is being asked the value of this property, so the collection must be used as contents. \\ \\ In case the collection is got directly from the application and do not as a content collection, this macro result will be got from the //default-mapcol// attribute, in case this attribute is defined, on the contrary it will be an empty string. \\ \\ |**default-mapcol:** This attribute is used to complete the previous one when the collection that has this property is used as base collection and do not as content collection. | \\ In this case the //mapcol// attribute will return the value this attribute will have. \\ \\ In the following example we show this behaviour:\\ \\ \\ In this example, the “**Recibos**” collection has been declared to be used as content collection in the “**Documentos**” collection. When this is done this way, the //mapcol// attribute returns the “Documentos” name, because this is its owner collection. \\ \\ In case the “Recibos” collection is got directly from the application and do not as content of “Documentos”, the //mapcol// attribute will return the “Facturas” value, which is the value by default. \\ \\ |**mapfld:** It indicates which field of the external collection is the one used to be linked to this property. In the previous example, the IDTIPO property is linked to the “TiposUsuario” collection through the ID field. | \\ The properties that this couple has usually are properties of link only, so they usually are invisible in the edition (visible=”0”). \\ \\ ==== linkedto="campo" | linkedfield="campo" ==== \\ These attributes indicate that the property has been got through a link to an external collection. It is defined for those properties starting with the MAP_ prefix to indicate that they come from a link among tables. \\ \\ The **linkedto** value must be the field used to be linked to the external collection, such as it is indicated in the following example: \\ \\ \\ This attribute is used together with the **linkedfield** attribute to indicate the link to another collection. In this case, it is indicated that the **MAP_TIPOUSER** field is linked through the **IDTIPO** field with the “TiposUsuario” collection. The field that corresponds to the **MAP_TIPOUSER** property is the one of the **ETIQUETA** property of the destination collection. The program does not use this relation for reading the data, since this is done by the SQL sentence, to make updates in cascade, as described later on. \\ \\ Another use of the // linkedto // attribute is to define the name of the property to which a property of type "bitmapped" is linked to, as described below.\\ \\ The Controls by Type section **[[wiki:2.-desarrollo-app:2.3.-codigo:b.-controles-xone:3.-controles-por-tipo:start]]** has a detailed explanation about how to build links by using the attributes explained before. \\ \\ ==== showinline="true/false" ==== \\ It showns the collection linked through the mapcol attribute as a drop-down menu. \\