Data Centric Functions

Test Your Knowledge

Task: Get Data as XML

  1. Create a global data type “Test.Users” with fields “Name” (string (64)), “Age” (Int32), “Email” (string (64)).
  2. Add 10 data items to the data type. Use the email addresses of two email servers (e.g. “gmail.com” and “yahoo.com”).
  3. Create an XSLT function “Test.ShowUsers”.
  4. Call the Test.Users.GetUsersXml function in the Test.ShowUsers function.
  5. Select the Name, Age and Email fields.
  6. Edit the XSLT to display user data (Name, Age, Email) in a table.
  7. Insert the Test.ShowUsers function on a page and preview the page.

Task: Sort Data

  1. Edit the Test.ShowUsers function.
  2. Sort the data retrieved by the Test.Users.GetUsersXml function by the Name field in ascending order.
  3. Preview the Test.ShowUsers function on the page it has been inserted on.

Task: Filter Data

  1. Edit the Test.ShowUsers function.
  2. Use the FieldPredicatesFilter to set the filter on the Test.Users.GetUsersXml function.
  3. Use the Composite.Utils.Predicates.StringEndsWith to filter data by the Email field so users with an email address of one server (e.g. “gmail.com”) should be retrieved.
  4. Preview the Test.ShowUsers function on the page it has been inserted on.

Task: Use Paging

  1. Edit the Test.ShowUsers function.
  2. Use the Page Size parameter on the Test.Users.GetUsersXml function to limit the number of retrieved data items to 2.
  3. Use Include Paging Info parameter and edit the XSLT to display the total number of users.
  4. Preview the Test.ShowUsers function on the page it has been inserted on.

Task: Use Active Page Reference Filter

  1. Create a metatype “Test.Summary” with one field “Text” (String (1024)) changing its widget from TextBox to TextArea.
  2. Add the metafield of this type to the root page of the website making sure the sub pages inherit it.
  3. Edit the root and sub pages to write different summaries for each page.
  4. Create an XSLT function “Test.ShowSummary” and call the Test.Summary.GetSummaryXml function in it.
  5. Use the Active Page Reference Filter to retrieve the summary text related to the current page.
  6. Select a page with the Summary meta field in the Page field (Debug) on the Settings tab of the Test.ShowSummary function.
  7. Preview the Test.ShowSummary function and check for the summary text in the Input pane.