web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Service | Customer Service, Contact Center, Fie...
Unanswered

How to remove last two characters in liquid code

(0) ShareShare
ReportReport
Posted on by 195

Hi,

KABrandfilter=1700070,1700071,1700072,1700073

brandfilter=1700070,1700071

{% capture bffilter %}
{% assign brand = {{KABrandfilters}} | split:"," %}
{% for item in brand %}
{% unless brandfilter contains item %}
new_brandmultiselectstring ne '{{item}}' or
{% endunless %}
{% endfor %}
{% endcapture %}

Output: new_brandmultiselectstring ne '1700072' or new_brandmultiselectstring ne '1700073' or

Want to remove the last two characters "or"

Required output : new_brandmultiselectstring ne '1700072' or new_brandmultiselectstring ne '1700073' 

Please help me with this.Thanks in advance!!

Regards,

Susritha

I have the same question (0)
  • LuHao Profile Picture
    40,892 on at

    Hi Susritha,

    You could remove "or" from the liquid code.

    {% capture bffilter %}
    {% assign brand = {{KABrandfilters}} | split:"," %}
    {% for item in brand %}
    {% unless brandfilter contains item %}
    new_brandmultiselectstring ne '{{item}}' or
    {% endunless %}
    {% endfor %}
    {% endcapture %}

  • Susritha Profile Picture
    195 on at

    If I remove "or" then how will I get new_brandmultiselectstring ne '1700072' or new_brandmultiselectstring ne '1700073' .Want to remove the last or

  • PriyankaKambleMSCRM365 Profile Picture
    5 on at

    Hi,

    We can add or as prefix while looping through and at last we can remove first or keyword. Below solution is tried and tested and works absolutely fine.

    Mark this answer as helpful if it’s works for u! Thanks in advance

    {% capture brandfiltersearchoptions %}

        {% if brandfilter[0]!='' %}

             {% for brandvalue in brandfilter %}

                {% if AllowedBrands contains brandvalue %}

                 {% if forloop.index > 1 %} or {% endif %}

                 {% if brandvalue =='717690000' %} BrandUSAA eq true {% endif %}

                 {% if brandvalue =='717690001' %} BrandMrCooper eq true {% endif %}

                 {% if brandvalue =='717690002' %} BrandVUL eq true {% endif %}

                 {% if brandvalue =='717690003' %} BrandUWM eq true {% endif %}

                 {% if brandvalue =='717690004' %} BrandPAD eq true {% endif %}

                {% endif %}

             {% endfor %}

       {% else %}

            BrandMrCooper eq true

       {% endif %}  

    {% endcapture %}

    {% assign brandfiltersearchoptions =  brandfiltersearchoptions | remove_first: "or"  %}

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Service | Customer Service, Contact Center, Field Service, Guides

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 22 Super User 2026 Season 1

#1
Suriyanarayanan V Profile Picture

Suriyanarayanan V 22

#3
Encore Business Solutions Profile Picture

Encore Business Sol... 14

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans