Datasource multi select?

At the moment the [{ catFullname }} and {{ item.ItemCatergories }} don’t match (see bottom of screenshot and code).

I also categorised 2 waste items Appliances and Blue Board and I got this as {{ item.ItemCategories }}
Waste types/Clean Concrete & Brick Waste/Accepted,Waste types/General Waste/Prohibited

Appliances

Blue Board

Life would be much easier with a checklist for data source @Treepl :wink:

            {% assign headings = 'Accepted,Costs,Prohibited' %}
            {% assign headingsArray = headings | split: ',' %}

            {% for heading in headingsArray %}
            {% assign cnt = 0 %}
            {% assign catFullname = heading | prepend: '/' | prepend: this.name %}
            <h3 class="h5">{{ heading }}</h3>

            {% for item in wasteItems.items %}
            {% if item.ItemCategories contains catFullname %}
            <span class="badge bg-light text-muted m-1 fw-normal">{{ item.name | split: "/" | last | downcase }}</span>
            {% assign cnt = cnt | plus: 1 %}
            {% endif %}
            {% endfor %}

            {% if cnt == 0 %}
            <p>No {{heading | downcase }} items.</p>
            {% endif %}
            {% endfor %}

            <pre>{{ catFullname }}</pre>
            <pre>{{ item.ItemCategories }}</pre>

Screenshot 2023-02-17 at 2.20.40 pm

I’m not really seeing the benefit of DataSource when there is so much of a workaround.
If you weren’t here @Adam.Wilson I would have thrown my keyboard out the window by now.
Sorry for taking so much of your time mate if you are ever in Brisbane hit me up ill shout all night!!

I could just go back to the manual way and put a check list on the bin types and they will just have to add and remove items as needed.

Thanks Luke. I think it’s very close to working now… I overlooked the top-level category name.

To fix the non-matching categories, try replacing this line:

{% assign catFullname = heading | append: 'Waste types/' | prepend: '/' | prepend: this.name %}

And if you have any other headings to match for, add them here:

{% assign headings = 'Accepted,Costs,Prohibited,Another Header,etc...' %}

Datasource works great if you only need 1 (or a fixed number of) relationships/connections. But yes, would be even more powerful if it allowed multiple selections.
At least there is a workaround for now.

Its working for Accepted but noting else?
I had to change this, is this right?

{% assign catFullname = heading | prepend: '/' | prepend: this.name | prepend: 'Waste types/' %}
{% assign headings = 'Accepted,Costs,Prohibited' %}
            {% assign headingsArray = headings | split: ',' %}

            {% for heading in headingsArray %}
            {% assign cnt = 0 %}
            {% assign catFullname = heading | prepend: '/' | prepend: this.name | prepend: 'Waste types/' %}
            <h3 class="h5">{{ heading }}</h3>

            {% for item in wasteItems.items %}
            {% if item.ItemCategories contains catFullname %}
            <span class="badge bg-light text-muted m-1 fw-normal">{{ item.name | split: "/" | last | downcase }}</span>
            {% assign cnt = cnt | plus: 1 %}
            {% endif %}
            {% endfor %}

            {% if cnt == 0 %}
            <p>No {{heading | downcase }} items.</p>
            {% endif %}
            {% endfor %}

            <pre>{{ catFullname }}</pre>
            <pre>{{ item.ItemCategories }}</pre>
            <pre>{{ item.name }}</pre>
            <pre>{{ heading }}</pre>
            <pre>{{ this.name }}</pre>

Screenshot 2023-02-17 at 6.28.17 pm

Oh it is working as this below
but in the module filterBy: “SkipBinTypes” need to be more then one datasource as I have multiple categories selected but the bin selected in datasource is the only one that shows.

            {% component source: "Skip Bins - Waste Items", layout: "List", filterBy: "SkipBinTypes", filterValue: "{{ this.id }}", sortBy: "ItemCategories", limit: "500", enablePagination: "false", object: "collection", collectionVariable: "wasteItems", type: "module" %}

            {% assign headings = 'Accepted,Costs,Prohibited' %}
            {% assign headingsArray = headings | split: ',' %}

            {% for heading in headingsArray %}
            {% assign cnt = 0 %}

            {% assign catFullname = heading | prepend: '/' | prepend: this.name | prepend: 'Waste types/' %}

            <h3 class="h6">{{ heading }}</h3>

            {% for item in wasteItems.items %}

            {% if item.ItemCategories contains catFullname %}
            <span class="badge bg-light text-muted m-1 fw-normal">{{ item.name | split: "/" | last | downcase }}</span>
            {% assign cnt = cnt | plus: 1 %}
            {% endif %}

            {% endfor %}
            {% endfor %}

But you only want to list waste items related to the one Bin Type, don’t you?
I don’t think I have a full understanding of the requirements. I’ve PM’ed you here in the forum for more info.