Clone a Row in a column

In a column block, I have a row with a label and a button.
I would like to clone this row to have 5 row in my column where each label have an incremental text.
To do so I do this:
image

But it doesn’t sound good to me 'cause there’s no referencing to the cloned row’s label.
Indded, I obtain this.


As you can see, I don’t have 1,2,3,4 and 5 but 5,1,2,3 and 4.
I’m looking for something like “in cloned row” set etichetta’s text to XXXXXX" But I can’t find it.
Can somone help me?
Thank you

Hi!

Create a Label in the Row you created by using this block. After this, you can set the Label’s text:
image

If you accept a piece of advice I prefer using Custom Data Viewer.

2 Likes

Eticetta refers specifically to the ORIGINAL label. If you want to change a label in the clone, you’ll need to get it’s ID, using something like


I’m getting the first (probably only) label in the new cloned row, and setting it’s text. You’ll find the blocks you need the the same drawer as the clone block.

5 Likes

Here’s how I do this after cloning a column containing a row with a button in it:

I’m looping through Firebase nodes but you could just replace the “for each j in list” with a counting loop instead.

The key – as I see @catsarisky just posted above – is to use the “all label in” block in the Any Components drawer and then to specify the # (order) of the label within the row. Is it the first label, the second label, etc.? The loop count variable I’m using just cycles through all rows in the column.

2 Likes

I’ve tried this way, but i Get all labels text to Manutenzione_1

1 Like

Interesting. Just for a moment, try adding a 1 second delay before the set label blocks, and see if the behavior changes?

1 Like

I didn’t show you the bottom of my loop block but I always add a “wait 0 seconds” block within the loop. I’m not sure why it makes a difference but it does.

2 Likes

Thank you both @tatiang and @catsarisky a wait block is what I needed. And 0 seconds solve the problem…Could it be a Live testing or preview problem or it happen even in app?
I’m opening an issue for that in github.

2 Likes

If interested in, I’ve created a Bug issue:

1 Like

What If I need to remove every clone?
Is there a way to do it?

1 Like

If you are cloning everything in a specific column then just remove that column
image

At the moment I have a column with 1 element and every time I press a button I have to clone that element several times.
The problem it that an the next time i press th button, I have to delete previous clones and create the new ones, so the column and the original one, should stay there

2 Likes

I would use custom data viewer if it worked :frowning: But we are still waiting for the fix.

I solved this way.
Other solutions are welcome :wink:

1 Like

I will use a more controlled way.

In the start of the app, I will use a variable to store the row ID for the row I want to keep
image

Then whenever I want to remove other rows I would do:
image

1 Like

Does it store the ID of the row or it’s characteristics? 'Cause I change components text even in the original row.

1 Like

This will store the component ID. You will find it in the Any component drawer.

If you use the one in the component drawer then you will get the content only.

1 Like