Dataset with a filter on dynamic url

I have a page that has a Dataset on it. I am identifying the Filter on the dataset in code. On one particular display, I am getting duplicates in the repeater. There are no duplicates in the Collection. Can you assist me?

You will have to provide more info.
You posted your post into the coding section, but i see no provided/used code on your site.

As you already mentioned, you surely are working with DATASETS connected to your database. It dosn’t mean that you can’t use code anymore, but you will have to describe your setup in detail.

Seeing a code on display tells you how it works.
Not seeing your whole setup and all connections of your datasets and DB = BIG PROBLEM !!!

Hello Velo-Ninja,
This code is setting up the Display Page. On the Display Page, there are 2 Dynamic Datasets. The data of each Dataset is defined by tag values in the Items Collection. Once the “Toolkit” Dataset (dataset2) and “Journey” Dataset (dataset1) are established, then the Filters define what data will be displayed by the Repeaters linked to each Dataset.

$w . onReady ( async () => {
session . setItem ( ‘prevPath’ , /toolkits )
const mymember = await wixUsers . currentUser
const mymemberEmail = ‘’
const tkName = await session . getItem ( ‘tkName’ );
const tkJourney = await session . getItem ( ‘tkJourney’ );
const altTitle = ‘’ ;
const tkImg = ‘’ ;
const tkSubTitle = ‘’ ;
const tkProgram = ‘’ ;
const tkPlan = ‘’ ;

wixData . query ( "ToolkitSetup" ) 
    . eq ( "title" ,  tkName ) 
    . limit ( 1 ) 
    . find () 
    . then ( ( results ) => { 
        **if** ( results . items . length  >  0 ) { 
            **let**  myitem  =  results . items [ 0 ] 
            console . log ( 'My Results' ,  results . items ) 
            $w ( "#altTitle" ). text  =  results . items [ 0 ]. altTitle 
            $w ( "#tkSubtitle" ). text  =  results . items [ 0 ]. subtitle 
            $w ( "#tkStrip" ). background . src  =  results . items [ 0 ]. image 
            $w ( "#tkProgram" ). link  =  results . items [ 0 ]. program 
            $w ( "#tkPlan" ). link  =  results . items [ 0 ]. plan 
            **if**  ( results . items [ 0 ]. title  ===  "D Toolkit" ) { 
                 $w ( "#stageFilter" ). enable (); 
                 $w ( "#text55" ). show (); 
                 $w ( "#text56" ). show (); 
            }  **else**  { 
                $w ( "#stageBox" ). hide (); 
                $w ( "#text57" ). hide (); 
            } 
        }  **else**  { 
            // console.log(results) 
        } 

        $w ( "#dataset2" ). setFilter (  wixData . filter () 
                . contains ( "toolkits" ,  tkName  )) 
        $w ( "#dataset1" ). setFilter (  wixData . filter () 
                . contains ( "journeys" ,  tkJourney  ))           
    });

Ok, let’s have a look.

First questions…

  1. Where is your …
$w('#dataset1').onReady(()=>{...});
  1. Where is your second one for second dataset?
$w('#dataset2').onReady(()=>{...});

When working with datasets —> your DATASETS must first be READY.
The same way like your page…

$w.onReady(async() => {...});

Next…why this ???

const tkName=awaitsession.getItem('tkName');
const tkJourney=awaitsession.getItem('tkJourney');

You are loading each value from the STORAGE?

Why you did not put your data as an STRINGIFIED-OBJECT into the STORAGE and get it back on the page you wish.

And you were talking about 2-DYNAMIC-DATASETS, but i don’t see any CODE for this!

You are sure that you know what a dynamic-dataset is?
Or did you mixed it up with NORMAL-DATASETS like i can see really 2 of them here inside your code.

$w('#dataset1')
$w('#dataset2')

Let me answer each question in order:

  1. and 2) I believe that I have skipped an important step here. I will go back to my full code soon this page and review.

  2. Why these constants? The page that I’m entering with these two Datasets changes based on specific Tags set by the User on the prior page. The ‘tkName’ and ‘tkJourney’ are variables that I use setItem on the prior page and retrieve with getItem when entering this page. These variables and the other constants being set are important in defining the data filters of datasets and other display items.
    const tkName = awaitsession . getItem ( ‘tkName’ ); const tkJourney = awaitsession . getItem ( ‘tkJourney’ );

  3. Am I using the term Dynamic Dataset incorrectly? Very possibly. I’ve been learning and reading on my own, trying to identify the correct terminology. Can you share the different between a Dynamic Dataset and a Normal Dataset?

Thanks.

Rebecca

Normal DATASET is a DATASET which is connected to a NON-DYNAMIC-PAGE.

A DYNAMIC-DATASET is a DATASET which is connected to a DYNAMIC-PAGE.

A DYNAMIC-PAGE is a PAGE which gets all DATA from a DATABASE and this DYNAMIC PAGE is connect to the DATABASE with the help of a DYNAMIC-DATASET.

When you create DYNAMIC PAGES a DYNAMIC-DATASET normaly will be generated AUTOMATICALY and will also be named as → “dynamicdataset”.

After you have created a DYNAMIC-PAGE you also normaly get two types of PAGES.

  1. A page where you will find a REPEATER, which will hold all the data in it.
  2. A page, which will show you always JUST–> 1-ITEM. And this page is the DYNAMIC one, where you only can see 1-Item. You will have to navigate on this page by the usage of PREVIOUS & NEXT-BUTTONS!

Everytime you click on to one of this two mentioned buttons, you either load the next or the previous ITEM out of DATABASE which is connected via a DYNAMIC-DATASET with your DYNAMIC-PAGE, where you can see this ONE-ITEM.

So, conclusion?
Where was the difference between a dynamic and a normal (static) DATASET ?

Also, when you create a DYNAMIC-PAGE, you will get an automatic generated DB-FIELD (greyed-out one), where all the linkings to all the dynamic pages will be stored.

So if you are working with …

  1. dataset1
  2. dataset2

These DATASETS are —> ??? RIGHT!!! —> NON-DYNAMIC ( STATIC )
And they are connect to a ??? RIGHT!!! —> STATIC-PAGE !!!

Maybe with this knowledge, you will be able now to get your CODE to work.

thank you.