aleksandar_trif
Returning Observer

Rule Maximum Entries

Jump to solution

Hello FS Community

I have an FS_CATALOG component, which uses 2 link templates:

      <FS_CATALOG name="st_links" viewMode="headers">

        <LANGINFOS>

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

        </LANGINFOS>

        <TEMPLATES type="link">

          <TEMPLATE uid="lt_internal_external"/>

          <TEMPLATE uid="lt_cta_btn"/>

        </TEMPLATES>

      </FS_CATALOG>

I want to write a rule with following logic:
IF editor selects lt_internal_external

     MAXIMUM 3 Entries

ELSEIF editor selects lt_internal_external as first and lt_cta_btn as second

     MAXIMUM 3 Entries

ELSE editor selects lt_cta_btn first as first

     MAXIMUM 1 Entry

I have written a rule that limits to maximum of 3 entries, and when we have 3 entries no new entries are allowed.

Current rule:

<!-- ### st_links max 3 entries -->

<RULE>

<WITH>

<LESS_THAN>

<PROPERTY name="SIZE" source="st_links"/>

<NUMBER>3</NUMBER>

</LESS_THAN>

</WITH>

<DO>

<VALIDATION scope="INFO">

<PROPERTY name="VALID" source="st_links"/>

<MESSAGE lang="*" text="Maximal 3 Einträge erlaubt!"/>

</VALIDATION>

<PROPERTY name="NEW" source="st_links"/>

</DO>

</RULE>

Is this even possible within FirstSpirit Rule syntax ?

My regards

Aleksandar

0 Kudos
1 Solution

Accepted Solutions
StefanSchulz
I'm new here

Hi Aleksandar,

It's a bit difficult, but you could achieve a somewhat similar logic by using the CONTAINS expression with FS_CATALOG, which checks for used templates.

The logic you could realize would be:

  • Have at most 3 entries
  • If the component contains an lt_cta_btn based entry only, limit to one

I have not tried it, but this should be doable.

You will find the documentation to CONTAINS online at: Online Dokumentation FirstSpirit - <CONTAINS/> Inhaltsprüfung

Hope this helps.

Cheers

Stefan

View solution in original post

0 Kudos
2 Replies
StefanSchulz
I'm new here

Hi Aleksandar,

It's a bit difficult, but you could achieve a somewhat similar logic by using the CONTAINS expression with FS_CATALOG, which checks for used templates.

The logic you could realize would be:

  • Have at most 3 entries
  • If the component contains an lt_cta_btn based entry only, limit to one

I have not tried it, but this should be doable.

You will find the documentation to CONTAINS online at: Online Dokumentation FirstSpirit - <CONTAINS/> Inhaltsprüfung

Hope this helps.

Cheers

Stefan

0 Kudos

Hello Stefan,

Thank you for the info. I will try to use data within the docs you mentioned.

Best regards

0 Kudos