Skip to main content

Fetch record from database and display in DOM

Comments

5 comments

  • Zendesk API User
    Author: hoebbel - 1/20/2022 11:34

    Dear Jayakumar

    you can define a CMS_HEADER within a format template and within this CMS_HEADER you can define a contentSelect function to fetch entities. (Just write the tags at the beginning of the source code of the formattemplate:
    <CMS_HEADER>
    <CMS_FUNCTION name="contentSelect" resultname="fr_myfunction">
    ...
    </CMS_FUNCTION>
    </CMS_HEADER>
    ...$CMS_FOR(for_entity,fr_myfunction)$...$CMS_END_FOR$...

    I hope you can solve your problem with this information.

    Hint: The result of the contentSelect function is only valid within the format template. So you should create the output within the format template itself. 

    Best regards
    Holger

    0
  • Zendesk API User
    Author: Jayakumar - 1/21/2022 5:19

    Is there any possible options to enable editors to select the requires dataset to be included in the DOM? The dataset contains a simple text.

    Is it possible to bring the functionality of FS_INDEX in DOM?

    0
  • Zendesk API User
    Author: hoebbel - 1/21/2022 6:52

     wrote:

    Is there any possible options to enable editors to select the requires dataset to be included in the DOM? The dataset contains a simple text.

    Is it possible to bring the functionality of FS_INDEX in DOM?


    If you use a link instead of a format template, you can use almost all input components (they must be language independent [useLanguages="no"]). 

    You cannot use the CMS_HEADER tag within the output channel of a link template, but if you need a contentSelect function there, you can use a format template via $CMS_RENDER (template:<uid>)$ and define the contentSelect function there.

    Another solution (for more technical editors) could be to define a format template, in which the marked text is used as value of a CMS_VALUE_PARAM of the contentSelect function. Should work like this:

    <CMS_FUNCTION name="contentSelect" resultname="..."> <CMS_PARAM name="schema" value="..." /> <CMS_VALUE_PARAM name="myParam" value="#content" /> <QUERY entityType="..."> <FILTERPARAM parameter="myParam" datatype="java.lang.String" value="%"/> <LIKE attribute="..." parameter="myParam"/> </QUERY> </CMS_FUNCTION>

    But this is a very technical solution and won't work with normal editors! 

    0
  • Zendesk API User
    Author: Jayakumar - 1/25/2022 6:56

    Hello,

    Please verify the step by step screen shot added for your reference.

    Screen 1:

     

     

    Screen 2:

    I am selecting link template,

     

     

     

     

     

     

    Screen 3:

    Populating database values,

     

     

    Screen 4;

    After Text Snippet #192 is selected ,

     

     

     

     

    The value inside #192,

    Ex: “Text of snippet should show up in actual text”

    Should populate in the Content

    i want to bring the selected values in the content.

    please do the needful.

     

    0
  • Zendesk API User
    Author: hoebbel - 1/27/2022 13:28

    Hallo Jayakumar,

    I'm sorry, but I can't find an out-of-the-box solution for this requirement.
    The following should work:
    Write a VALUE service that is used in the rules to transfer the corresponding content from the selected dataset into a text field of the link.
    Define the text field into which the content is copied as link text on the properties tab of the link template. (The content of a corresponding text field is the one that is displayed in the DOM).

    The problem that, in my estimation, cannot be solved at the moment without a VALUE service is to take the text field from the record. It is possible, for example, if a CMS_INPUT_COMBOBOX is used to select the data set, to use its ID per rule without any problems:
    <RULE>
    <WITH>
    <PROPERTY name="ENTRY" source="COMBOBOX"/>
    </WITH>
    <DO>
    <PROPERTY name="VALUE" source="TEXTFIELD"/>
    </DO>
    </RULE>
    But then the ID would be shown within the CMS_INPUT_DOM, which doesn't help editors.

    You can make two different feature requests if you want an out-of-the-box solution (but this will take some time):
    Either the already existing VALUE service should be extended accordingly, so that it can take over data from a data set by means of another input component (at the moment this is only possible via the GID, but you can't get it by rule from an input component with a data set).
    Or it should be possible to select a corresponding input component (e.g. CMS_INPUT_COMBOBOX or FS_DATASET) as text field for the link.

     

    Best regards
    Holger

    0

Please sign in to leave a comment.