Checking if there is a structured data node

sbarre5's Avatar

sbarre5

04 Mar, 2015 09:56 PM

Once i've successfully gotten into my block using the locator tool, is there a way to check to see if the block has a structured data node?

  1. sbarre5 closed this discussion on 04 Mar, 2015 09:56 PM.

  2. sbarre5 re-opened this discussion on 04 Mar, 2015 09:56 PM

  3. 1 Posted by sbarre5 on 04 Mar, 2015 09:57 PM

    sbarre5's Avatar

    I posted this in the wrong category and I can't move it - this should be in velocity formats

  4. 2 Posted by Ryan Griffith on 05 Mar, 2015 06:46 PM

    Ryan Griffith's Avatar

    Hi,

    Assuming the block is a Structured Data Block, you can use the getStructuredDataNode("path/to/field") method to obtain the field. If the field does not exist, the method should return null, which can be tested using $_PropertyTool.isNull().

    Once you get the field, you can then test it's value to see if it is empty or not.

    Please let me know if you have any questions.

    Thanks!

  5. 3 Posted by sbarre5 on 05 Mar, 2015 06:52 PM

    sbarre5's Avatar

    Thanks Ryan. That works great!

    Saundra Barrett
    Senior Web Developer
    Emory University, Web Design Group
    Office: 404-727-3437
    Cell: 404-670-1238

    From: Ryan Griffith
    Date: Thursday, March 5, 2015 at 1:47 PM
    To: Saundra Barrett
    Subject: Re: Checking if there is a structured data node [Velocity Formats #11584]

  6. 4 Posted by Ryan Griffith on 05 Mar, 2015 06:53 PM

    Ryan Griffith's Avatar

    Not a problem at all, Saundra, thank you for following up. I am glad to hear my suggestion did the trick.

    I'm going to go ahead and close this discussion, please feel free to comment or reply to re-open if you have any additional questions.

    Have a great day!

  7. Ryan Griffith closed this discussion on 05 Mar, 2015 06:53 PM.

Discussions are closed to public comments.
If you need help with Cascade CMS please start a new discussion.

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

 

26 Aug, 2016 01:19 PM
25 Aug, 2016 03:02 PM
25 Aug, 2016 12:50 PM
24 Aug, 2016 08:43 PM
24 Aug, 2016 07:20 PM
21 Aug, 2016 01:20 PM