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

  • 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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

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

#1
Daniyal Khaleel Profile Picture

Daniyal Khaleel 60 Most Valuable Professional

#2
11manish Profile Picture

11manish 23 Super User 2026 Season 2

#3
Travis South Profile Picture

Travis South 14

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans