andreas_schaedl
Occasional Observer

Dynamic query, then sort selection

Jump to solution

Hello community,

I have some trouble finding a solution for my current problem, maybe somebody can point me into the right direction?

The current situation (names changed):

At the moment  I use a CMS_INPUT_COMBOBOX to select a category.

<CMS_INPUT_COMBOBOX name="st_cat" hFill="yes" useLanguages="no">

    <CMS_INCLUDE_OPTIONS type="database">

      <LABELS>

        <LABEL lang="*">#item.name</LABEL>

      </LABELS>

      <TABLE>scheme.cat</TABLE>

    </CMS_INCLUDE_OPTIONS>

    <LANGINFOS>

      <LANGINFO lang="*" label="Category"/>

    </LANGINFOS>

</CMS_INPUT_COMBOBOX>

This category serves as a filter for the selectable options in a CMS_INPUT_LIST.

  <CMS_INPUT_LIST name="st_prod" hFill="yes" sortOrder="keep_order" useLanguages="no">

    <CMS_INCLUDE_OPTIONS type="database">

      <LABELS>

        <LABEL lang="*">#item.name</LABEL>

      </LABELS>

      <QUERY name="scheme.prod_filter">

        <PARAM name="catId">0</PARAM>

      </QUERY>

      <TABLE>scheme.product</TABLE>

    </CMS_INCLUDE_OPTIONS>

    <LANGINFOS>

      <LANGINFO lang="*" label="Product"/>

    </LANGINFOS>

  </CMS_INPUT_LIST>

The PARAM for the QUERY is set dynamically via rules.

<RULE>

     <IF>

          <NOT>

               <PROPERTY name="EMPTY" source="st_cat"/>

          </NOT>

     </IF>

     <WITH>

          <PROPERTY name="VALUE" source="st_cat"/>

     </WITH>

     <DO>

          <PROPERTY name="query.catId" source="st_prod"/>

     </DO>

</RULE>

This works fine at the moment.

The desired change:

The products selected now need to be ordered manually for the output.

While CMS_INPUT_LIST allows rearranging of the selected items via Drag&Drop, this order is reset once the template is closed (is this a bug?). See:

Re: Anzeige (Sortierung) in CMS_INPUT_LIST

FS_INDEX doesn't allow manual ordering and I also didn't get the dynamic query to work. See:

FS_INDEX dynamisch query param setzen

FS_INDEX-Sortierung (für DatasetDataAccessPlugin) ermöglichen

FS_LIST (I am aware that it will be deprecated) allows manual ordering, but does not accept a dynamic query. See:

Dynamische Befüllung eines Querys über eine Regel

Re: Formular Comboxbox Database Query Param setzen

So my question is: is there no way to

  1. prefilter datasets based on a category
  2. select some of the remaining datasets
  3. manually change the order of the selected datasets?

Sorry for the long post and thanks for any help.

Cheers,

Andreas

0 Kudos
1 Solution

Accepted Solutions
kohlbrecher
Crownpeak employee

Hello Andreas,

the order problem with the CMS_INPUT_LIST is no bug. The documentary says this:

The output always takes into account the order of the entries given in the form definition. The order of the entries within the output cannot be influenced by the editor. If the order of the entries is to be taken into account in the output, the FS_LIST input component should be used (where applicable).

But as you say FS_LIST is no option for you.

From my point of view the combination of a dynamic query and manually ordering is not possible. There could be more than one query on the data.

Best regards

Jan

View solution in original post

0 Kudos
1 Reply
kohlbrecher
Crownpeak employee

Hello Andreas,

the order problem with the CMS_INPUT_LIST is no bug. The documentary says this:

The output always takes into account the order of the entries given in the form definition. The order of the entries within the output cannot be influenced by the editor. If the order of the entries is to be taken into account in the output, the FS_LIST input component should be used (where applicable).

But as you say FS_LIST is no option for you.

From my point of view the combination of a dynamic query and manually ordering is not possible. There could be more than one query on the data.

Best regards

Jan

0 Kudos