Copied to clipboard

Flag this post as spam?

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

  • Andrew Southern 3 posts 43 karma points
    Jun 30, 2023 @ 12:50
    Andrew Southern

    Computed label based on document type properties

    Hi, I'm trying to create a computed field based on other properties. The setup is:

    • Document Type "ingredient" - "name"
    • Element Type "ingredient list item" - "quantity, scale, ingredient(content picker)"

    On the Element type, how do I create a computed field that is a formatted version of the other fields? The end result should be something like "${quantity}{scale} - {}"

    Thanks in advance.

  • Andrew Southern 3 posts 43 karma points
    Jun 30, 2023 @ 18:45
    Andrew Southern

    A solution/work around was found by a team member.

    Using the label of block in a Block List:

    {{ quantity }}{{ scale }} - {{ ingredient | ncNodeName}}

  • rocky 4 posts 73 karma points
    Jul 03, 2023 @ 06:42

    To create a computed field in Umbraco 9 that is a formatted version of other fields, you can use the Computed Field property editor. Here's how you can achieve the desired result:

    Navigate to the Document Type "ingredient" in the Umbraco backoffice. Locate the Element Type "ingredient list item" and open it for editing. Add a new property of type "Computed Field" to the "ingredient list item" Element Type. Let's call it "formattedIngredient" for this example. In the "Expression" field of the "formattedIngredient" property, you can write the code to compute the desired value. Use the following syntax:

    ${quantity} + ${scale} + " - " + ${}

    This expression concatenates the values of the "quantity" and "scale" fields with the "" field, separated by " - ".

    Save the changes to the Element Type. Now, whenever you create or update an "ingredient list item" content item, the "formattedIngredient" field will automatically compute its value based on the values of the other fields.

    Make sure to adjust the expression according to your specific field names and formatting requirements. Also, remember to save and publish your changes to see the computed field in action.

    Please note that the Computed Field property editor might have some variations depending on the version of Umbraco you are using.

  • Biagio Paruolo 1593 posts 1824 karma points c-trib
    Jul 17, 2023 @ 07:28
    Biagio Paruolo

    Sorry, Do you have a real example? We don't understand how to you do this. Thanks.

  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 7x admin c-trib
    Jul 17, 2023 @ 10:22
    Chriztian Steinmeier

    Hi Biagio,

    If you're looking for a way to do this (for display purposes), the Render Macro property editor in Contentment could be used — it lets you use a macro for rendering a value to display for a property (but doesn't store it).

    The macro has the usual access to Content etc. so you can compute a display value and render it alongside all other properties.

    Hope that helps,


  • Biagio Paruolo 1593 posts 1824 karma points c-trib
    Jul 03, 2023 @ 12:01
    Biagio Paruolo

    Where is Computed Field property editor?

  • Andrew Southern 3 posts 43 karma points
    Jul 03, 2023 @ 14:52
    Andrew Southern

    The "Computed Field" is a hallucination from ChatGPT. The field doesn't exist.

Please Sign in or register to post replies

Write your reply to: