Empty field in dataset

Hi! I have a Dynamic Page with a repeater #listRepeater connected with dataset #DynamicDataset
When the repeater displays a list of the dataset 3 records into conteiner #conteiner1 i want to collapse the text elements if the record fields are empty!!!
I want to check dataset field MemberPhone conected with element #text6 at the conteiner

It could be me, but I have this nagging feeling something is missing in your post, like a question.


    "_id": "1",
    "firstName": "Jane",
    "memberPhone": "0122345772634xxx"
    "_id": "2",
    "firstName": "Josh",
    "memberPhone": "01533452326xxx"

	$w('#myRepeaterIDhere').data = EXAMPLE_REPEATER_DATA;

	$w('#myRepeaterIDhere').onItemReady(($item, itemData, index)=>{
		if(itemData.memberPhone) {$item('#text6').expand();}
		else {$item('#text6').collapse();}


        let item = $w("#dynamicDataset").getCurrentItem();
        else {$w("#text6").collapse();}

Hi!! Thanks for your help

I think that works when you have to dispaly 1 record. I have a repaeter that list a few records and i want that check for each record.
As i understand onready is working after all records has been dispalyed so the ite, values are undefined !!!
How can i check the item.value for each record and then expand or collapse the ellement ???

I just tried to understand what is connected to what in your setup1?

  1. How much datasets are involved?
  2. How much repeaters involved?
  3. You say your REPEATER is on the DYNAMIC page.
  4. The dynamic page itself is already connected with dynamic-dataset, right?
  5. So REPEATER is connected with another dataset → “dataset3”.
  6. Screenshot of your setup ?

Please elaborate more about your project and database-structure.

@russian-dima I have 1 Dynamic Page connected with 1 dataset #dynamicDataset and 1 repeater connected with the same dataset.
The dataset has 3 records (for test) so the repeater display 3 items as well.
Until now using the code below i can check if there are empty elements in each of the repeater items.

let say that i want to check elements ( description, text6, text7)

$w ( ‘#listRepeater’ ). forEachItem (( $item , itemData , index ) => {

if ( $item ( “#description” ). text) { $w ( “#description” ). expand ();
else { $w ( “#description” ). collapse ();

if ( $item ( “#text6” ). text) { $w ( “#text6” ). expand ();
else { $w ( “#text6” ). collapse ();

if ( $item ( “#text7” ). text) { $w ( “#text7” ). expand ();
else { $w ( “#text7” ). collapse ();

My problem now is that because all elements (description, text6, text7) has the same name_id in all the repeater items, if one element (description) is not empty at the items 1 and 2 but is empty at 3 that collapse (description) in all items on the repeater !!!

I know that each repeater item has an ID starting for 0. I wonder if i can handle and collapse/expand element (description) sepereted for each item ID and not for all (description) in the repeater with the same name???

Almost forgot about you and your post :sweat_smile:, just found it again, right now.

Do some testings:

Copy&Paste this code onto your page, where your repeater is located on.
Deactivate all your other code on the page.
Run the code (in preview-, or published mode, doesn’t matter) and make a screenshot of the shown RESULTS (do not forget to pen the 3x-dots —> … <— to get mor details.

$w.onReady(()=>{console.log("Page is ready!")
    $w('#listRepeater').data = EXAMPLE_REPEATER_DATA;

    $w('#listRepeater').onItemReady(($item, itemData, index)=>{
        console.log("Item-Data: " + itemData + " / Index: " + index);
        console.log("Title: ", itemData.title);
        console.log("Description: ", description);
        console.log("Phone: ", itemData.memberPhone)
        if(itemData.memberPhone) {$item('#text6').expand();}
        else {$item('#text6').collapse();}