Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Peter Schermers 112 posts 134 karma points
    Sep 04, 2012 @ 12:41
    Peter Schermers
    0

    createDate

    How can I retrieve the 'createDate' data from my Embedded Content DataType?

    I don't need the createDate from the PAGE, but from every single record I used in Embedded Content.

  • Peter Schermers 112 posts 134 karma points
    Sep 07, 2012 @ 08:45
    Peter Schermers
    0

    I mean, as far as I know are the records you can make in Embedded Content just different ways of creating pages, but then in a neat way.
    And because you can always view the createDate of PAGES, I thought there might be some way to view the createDates of this new way of 'paging' (Embedded Content) as well. Isn't there?

  • Drew 165 posts 340 karma points
    Sep 07, 2012 @ 09:32
    Drew
    0

    Are you referring to the Embedded Content package?
    http://our.umbraco.org/projects/backoffice-extensions/embedded-content 

    If so, there's an example on the page of how it stores data - as far as I'm aware it simply stores the XML representation of all the values in your embedded content list inside the property value for that page instance - not as separate pages.
    So, this means there#s no "createdDate" field, although you could possibly add it as a field - meaning the user would have to specify the value, or assume a value, or modify Embedded Content to automatically store a createdDate and updatedDate for each entry (which would be quite handy!).

    <productSpecification> 
      <data> 
        <item id="1"> 
          <name propertyid="1">Package measurements</name> 
          <value propertyid="2">200cm x 15cm x 150cm</value> 
          <mediaItem propertyid="3" /> 
          <contentItem propertyid="4" /> 
          <validFrom propertyid="5" /> 
        </item> 
        <item id="2"> 
          <name propertyid="1">Packaged weight</name> 
          <value propertyid="2">5.3</value> 
          <mediaItem propertyid="3" /> 
          <contentItem propertyid="4" /> 
          <validFrom propertyid="5" /> 
        </item> 
        <item id="3"> 
          <name propertyid="1">Available colors</name> 
          <value propertyid="2">yellow, green, blue</value> 
          <mediaItem propertyid="3">1062</mediaItem> 
          <contentItem propertyid="4">1065</contentItem> 
          <validFrom propertyid="5">2011-01-14 00:00</validFrom> 
        </item> 
      </data> 
    </productSpecification>

     

    The simply way to check what is stored is to just <xsl:copy-of select="$currentPage/myPropertyThatStoresEmbeddedContent"/> and see what it's storing.

     

    Cheers,
    Drew 

  • Peter Schermers 112 posts 134 karma points
    Sep 07, 2012 @ 09:41
    Peter Schermers
    0

    Hi Drew,

    Thanks, I indeed meant the Embedded Content package (did I post my question on the wrong page of the forum?).
    To be honest, I actually don't really understand what you mean, your example (code) doesn't lighten things up either :-(

    Or are you just saying it ain't possible and that I should edit the Embedded Content package (of which I'm not capable)?

    Thanks again! 

  • Drew 165 posts 340 karma points
    Sep 07, 2012 @ 09:53
    Drew
    0

    Hah, ignore me - I just scanned the "50 latest most active topics" to see who needed help - I didn't notice that this post was in the Embedded Content forum itself! Doh!

    The quick answer is: No, there is no createdDate for EmbeddedContent items - you simply have access only to the properties (fields) you add to your Embedded Content instance.

    By default, the Embedded Content package doesn't store a created date or updated data against each item you add to it.
    (for example, if you create a "ourTeam" property, which uses EmbeddedContent to let you add a list of people).

    It stores all the values from your list as XML, in a property for that page - just like it stores all the other properties such as "Page Title", "Page Content" and any other properties you add.

     If you wanted it to, you'd need to either add a new property to your Embedded Content instance, called "createdDate" and require the user to fill it in, or modify the source.

    ----------------

    One question is - what is the scenario that you're using Embedded Content for?
    There may be a different way of archieving similar results.

    For example, if you're using Embedded Content to add a "Page Sponsors" or "Our Team" list. In the latter example you could instead create a "Settings" area on your website, and within that a "People" section, then allow users to create pages that simply have properties for a Person, such as "Forename", "Position", "Favourite Colour".
    You can then create an instance of Multi-Node Tree Picker (see uComponents) that allows a user to drag and drop team members onto a page.

    In this way, you're actually creating document instances (pages) to store the data, so you'll have access to all the common properties that comes by default on a page, such as createdDate - but you're not using them as pages on your website. 

    Here's an example:
     

     

    ---




     

    Cheers,
    Drew 

  • Peter Schermers 112 posts 134 karma points
    Sep 07, 2012 @ 10:51
    Peter Schermers
    0

    Hi Drew,

    Thank you for your extended explaination!
    I actually do fully understand how Embedded Content works, and how to use it.

    But the answer you gave about each field being saved without an automatically created createDate is exactly what I was after ;-)
    Of course I could make the user fill in a 'publish date', but that's exactly what I NOT wanted to do.

    Looking at usability, I wanted an input field ('date') for my users in which they can enter the date. But I also wanted that, if a user hadn't filled in this field, it automatically used the 'createDate' of this field in Embedded Content. Just like a page. I just don't want to use pages (nodes) for these items since I made myself a rule where the left side of the UI is only meant for pages, not for content (or parts of content). I know: I'm being difficult here. ;-) 

    But after all I guess what I wanted is not possible, unfortunately... :-( 

  • Drew 165 posts 340 karma points
    Sep 07, 2012 @ 11:10
    Drew
    0

    I guess a hacky way that you may be able to achieve it would be to create the date field you want, then add some JS to the onClick event of the add/save button on EmbeddedContent that simply checks for instances of that field and if they have no value, insert the current date, then allow the form to submit?

    Bit hacky, but would work hopefully.

    Cheers,
    Drew 

  • Peter Schermers 112 posts 134 karma points
    Sep 07, 2012 @ 11:25
    Peter Schermers
    0

    Haha true, I could try that. :-D

    But for now (with one eye looking at the clock), I think I'm just gonna stick to 'nope, it's not possible' to my client ;-)

    But thanks for all your help!

Please Sign in or register to post replies

Write your reply to:

Draft