Data Centric Functions
Test Your Knowledge
- Create a global data type “Test.Users” with fields “Name” (string (64)), “Age” (Int32), “Email” (string (64)).
- Add 10 data items to the data type. Use the email addresses of two email servers (e.g. “gmail.com” and “yahoo.com”).
- Create an XSLT function “Test.ShowUsers”.
- Call the Test.Users.GetUsersXml function in the Test.ShowUsers function.
- Select the Name, Age and Email fields.
- Edit the XSLT to display user data (Name, Age, Email) in a table.
- Insert the Test.ShowUsers function on a page and preview the page.
- Edit the Test.ShowUsers function.
- Sort the data retrieved by the Test.Users.GetUsersXml function by the Name field in ascending order.
- Preview the Test.ShowUsers function on the page it has been inserted on.
- Edit the Test.ShowUsers function.
- Use the FieldPredicatesFilter to set the filter on the Test.Users.GetUsersXml function.
- 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.
- Preview the Test.ShowUsers function on the page it has been inserted on.
- Edit the Test.ShowUsers function.
- Use the Page Size parameter on the Test.Users.GetUsersXml function to limit the number of retrieved data items to 2.
- Use Include Paging Info parameter and edit the XSLT to display the total number of users.
- Preview the Test.ShowUsers function on the page it has been inserted on.
Task: Use Active Page Reference Filter
- Create a metatype “Test.Summary” with one field “Text” (String (1024)) changing its widget from TextBox to TextArea.
- Add the metafield of this type to the root page of the website making sure the sub pages inherit it.
- Edit the root and sub pages to write different summaries for each page.
- Create an XSLT function “Test.ShowSummary” and call the Test.Summary.GetSummaryXml function in it.
- Use the Active Page Reference Filter to retrieve the summary text related to the current page.
- Select a page with the Summary meta field in the Page field (Debug) on the Settings tab of the Test.ShowSummary function.
- Preview the Test.ShowSummary function and check for the summary text in the Input pane.