Filtering Dataset information via tags - Transforming into 'counts'

Hi,

I’m very new to coding so apologies as my knowledge is very limited and i’m unable to figure this out.

Essentially my user ‘uploads’ a vehicle via a form which populates a new item in the dataset. On the form they have the option to select 1 of 3 tags - ‘In stock’ ‘In Pre’ or ‘Due In’ (see image below for context).

p

Once this information is submitted it then submits the entry to the data set and adds the relevant tag, this tag will be used to filter the vehicles on a seperate page via a repeater.

Once submitted I would like for the ‘item count’ to be displayed on the main dashboard page via a ‘item count’ connection. I’ve managed to add this to the below ‘in stock’ widget but i’m unable to figure out how to filter the data set via tags and then display the count in the second widget (see image below).

As I said my coding knowledge is non existent so if anyone could provide some advice or example codes/videos that would be great.

I will also then be needing a way to allow my users to edit a dataset item via a secondary form in which they can then set the ‘Vehicle Stage’ Tag to ‘Sold’ in which it will then populate in the sold section of the repeater so if anyone knows how to do that too it would be great.

thank you

@CODE-NINJA @codequeen - any support please?

Hi guys,

this is figured out -

For anyone wondering this was the work around

import wixData from 'wix-data';

$w.onReady(async function () {
    const countByTag = await
    wixData.query('yourCollection').eq('yourTagField', 'yourTag').count();
    $w('#componentToDisplayCount').text = '' + countByTag;

});
2 Likes