What's a UDM Dataports Foreign Keys
 
User Data Model
 
The following is intended to give you an overview of User-level Data Models (UDMs) as used in zeroCode. This covers only the basic concepts associated with UDMs, so it ignores many of the details of the real UDMs in zeroCode’s Design Environment. You can read more about those details in the rest of the tutorial pages on this site.  
What is a UDM?
 
A UDM (User-level Data Model or User Data Model) is a collection of data items that “belong together” in some sense – typically in the sense that they will be retrieved (or stored) in response to a single web request. In other words, the UDM is a “map” of retrieved or stored data in the manner in which it will appear on screen. Each UDM’s elements are organized as a tree, so that it is easier to comprehend. For example, suppose you wanted to create a simple web page that displays a person’s attributes, all of which come from a database table. You might then specify the data elements you will show in a “UDM tree” that looks like this:
 
     personUdm
          person
               lastName
               firstName
               dateOfBirth
               gender
                                   Figure 1
 
The indented structure is meant to represent a tree whose root is named personUdm, and the root has a single child named person. The children of this child are the actual data elements to be shown in the web page. Not coincidentally, the names of these elements are the same as those of the columns of the table from which the data is read.
 
With the zeroCode engine, you can retrieve (or store) all the data specified in a UDM in a single request. Suppose, then, that you created a web page that invoked the zeroCode engine to retrieve the above UDM’s data. That page could use access UDM’s data elements in an HTML template like this:
 

<html>
<body>
         ${personUdm.person.firstName}
         ${personUdm.person.lastName}<br>
         Born ${personUdm.person.dateOfBirth}
</body>
</html>


The ${ and } symbols are used to demarcate a reference to the UDM’s data element. Such a reference is called a template variable.[1] The data element is named using the sequence of names from the tree’s root to the element, separated by periods. In this example, after zeroCode replaces the template variables with corresponding values, the output HTML might look like this:

<html>
<body>
      John Doe<br>
      Born 4/10/1964
</body>
</html>

_____________________________________________________________________

[1] This syntax depends, of course, on the template engine. The one used by zeroCode, requiring the above syntax, is FreeMarker, an open-source Java template engine. See  http://freemarker.sourceforge.net for documentation.

   

 
 
  What's a UDM Dataports Foreign Keys