- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Fetch record from database and display in DOM
Hello,
In format template, can we fetch data from data source?
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Jayakumar 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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
![](/skins/images/0326C7BBAF2F2149B10693F5E376F514/responsive_peak/images/icon_anonymous_message.png)
![](/skins/images/0326C7BBAF2F2149B10693F5E376F514/responsive_peak/images/icon_anonymous_message.png)