Search the FirstSpirit Knowledge Base
Hello all,
Is it possible to set a query dynamically - with RULES?
RADIOBUTTON:
<CMS_INPUT_RADIOBUTTON name="st_type" gridHeight="1" gridWidth="1" hFill="yes" useLanguages="no">
<ENTRIES>
<ENTRY value="video">
<LANGINFOS>
<LANGINFO lang="*" label="Video"/>
</LANGINFOS>
</ENTRY>
<ENTRY value="whitepaper">
<LANGINFOS>
<LANGINFO lang="*" label="Whitepaper"/>
</LANGINFOS>
</ENTRY>
</ENTRIES>
<LANGINFOS>
<LANGINFO lang="*" label="Media type"/>
</LANGINFOS>
</CMS_INPUT_RADIOBUTTON>
FS_INDEX:
<FS_INDEX name="st_rowlist" useLanguages="no">
<LANGINFOS>
<LANGINFO lang="*" label="Videos"/>
</LANGINFOS>
<SOURCE name="DatasetDataAccessPlugin">
<QUERY name="LandingPage.insights_library">
<PARAM name="title">video</PARAM>
</QUERY>
<TEMPLATE uid="LandingPage.video_library"/>
</SOURCE>
</FS_INDEX>
Query:
<QUERY entityType="video_library1">
<FILTERPARAM parameter="title" datatype="java.lang.String" value=""/>
<LIKE attribute="Type" parameter="title"/>
</QUERY>
So if I choose "Video" then to set the parameter value to "video", else to set parameter name to "whitepaper".
Also, I have set the default value to "video":
but it doesn't show up:
How to set it to "video" (default value)?
Best regards,
Dragan
Hi Dragan,
for datasources you should always use preset="copy" in the input component definition (in your case: the radiobutton) so that the value is really saved with that preset instead of just being a fallback in the form.
To modify a query via rules, please have a look here: FirstSpirit Online Documentation - VALUE property
Michael
Hi Dragan,
for datasources you should always use preset="copy" in the input component definition (in your case: the radiobutton) so that the value is really saved with that preset instead of just being a fallback in the form.
To modify a query via rules, please have a look here: FirstSpirit Online Documentation - VALUE property
Michael
Hi Michael,
The preset="copy" works fine, but only with new entries. I'll keep that in mind.
Thank you, I figured it out.
I'll put my solution here if anyone needs it.
QUERY:
<QUERY entityType="video_library1">
<FILTERPARAM parameter="type" datatype="java.lang.String" value=""/>
<LIKE attribute="Type" parameter="type"/>
</QUERY>
FORM:
<CMS_INPUT_RADIOBUTTON name="st_type" gridHeight="1" gridWidth="1" hFill="yes" useLanguages="no">
<ENTRIES>
<ENTRY value="video">
<LANGINFOS>
<LANGINFO lang="*" label="Video"/>
</LANGINFOS>
</ENTRY>
<ENTRY value="whitepaper">
<LANGINFOS>
<LANGINFO lang="*" label="Whitepaper"/>
</LANGINFOS>
</ENTRY>
</ENTRIES>
<LANGINFOS>
<LANGINFO lang="*" label="Media type"/>
</LANGINFOS>
</CMS_INPUT_RADIOBUTTON>
<FS_INDEX name="st_rowlist" useLanguages="no">
<LANGINFOS>
<LANGINFO lang="*" label="Videos"/>
</LANGINFOS>
<SOURCE name="DatasetDataAccessPlugin">
<QUERY name="LandingPage.insights_library"/>
<TEMPLATE uid="LandingPage.video_library"/>
</SOURCE>
</FS_INDEX>
RULES:
<RULE>
<WITH>
<PROPERTY name="VALUE" source="st_type"/>
</WITH>
<DO>
<PROPERTY name="query.type" source="st_rowlist"/>
</DO>
</RULE>
Kind regards,
Dragan