Get Data from Assigned Page

mark.jones's Avatar

mark.jones

05 Jan, 2015 09:53 PM

I've setup a Data Definition that has a page as a field. When rendering that data definition, I want to get the Structured Data from the assigned page, but the data is not present in the XML. How do I get the structured data from an assigned page?

  1. 1 Posted by mark.jones on 05 Jan, 2015 09:58 PM

    mark.jones's Avatar

    I'm using a calling-page block that appends the page data to supply the data... I've tried to use the Locator Tool but don't understand how to get the structured data from there, if that's what it's for. I'm puzzled.

  2. 2 Posted by Wing Ming Chan on 06 Jan, 2015 01:39 PM

    Wing Ming Chan's Avatar

    Hi Mark,

    To answer your question, I have to make the following assumptions:

    1. You have a data definition block, with either a page chooser or a linkable chooser, attached to a page region of a page
    2. You have a Velocity format attach to the same region at the page level
    3. The page chooser/linkable chooser is associated with a page

    If my assumptions are accurate, then you can access the structured data of the page by following these steps:

    1. Get the page information:
    #set ( $data = $_XPathTool.selectSingleNode( $contentRoot, "/system-data-structure" ) )
    #set ( $page_chooser = $_XPathTool.selectSingleNode( $data, "group/page-chooser" ) )
    #set ( $site = $_XPathTool.selectSingleNode( $page_chooser, "site" ) )
    #set ( $path = $_XPathTool.selectSingleNode( $page_chooser, "path" ) )
    
    1. Get the page using the Locator tool
    #set ( $page = $_.locatePage( $path.value, $site.value ) )
    
    1. Once you have the page, you can call getStructuredDataNode through the page object. See Using Locator/Query Tool API in Velocity (Cascade 7.12.2) for more information.

    Wing

  3. 3 Posted by mark.jones on 06 Jan, 2015 06:43 PM

    mark.jones's Avatar

    Yes, your assumptions are fine. It took me a while to figure out the path to the data that I want: getStructuredData('path/to/data'). I think I'm all set now. Thank you!

  4. Ryan Griffith closed this discussion on 06 Jan, 2015 07:17 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac