Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Script to remove all rows in a table except the first

Avatar

Avatar
Validate 10
Level 3
Geckoz100
Level 3

Likes

20 likes

Total Posts

143 posts

Correct Reply

3 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 10
View profile

Avatar
Validate 10
Level 3
Geckoz100
Level 3

Likes

20 likes

Total Posts

143 posts

Correct Reply

3 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 10
View profile
Geckoz100
Level 3

26-04-2016

Please see the screenshots for the question/radio button I'm scripting.  If "No" is clicked I would like it to delete all rows except the first one.  So if the user first clicks Yes, adds a bunch of rows and then clicks No, I want all the extra rows to be deleted.  I'm using the script below but it only deletes half of the rows at a time.  I have to click No 2-3 times to delete all the rows.  Greatly appreciate any help!

// remove extra rows that may have been added

var rowCount = Page2.UserList.Table1._RowUserName.count;

for (var i=0; i<rowCount; i++) {

  Page2.UserList.Table1._RowUserName.removeInstance(i);

}

LCD1.png

lCD2.png

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Springboard
MVP
Magus069
MVP

Likes

143 likes

Total Posts

1,077 posts

Correct Reply

155 solutions
Top badges earned
Springboard
Validate 1
Ignite 3
Ignite 1
Establish
View profile

Avatar
Springboard
MVP
Magus069
MVP

Likes

143 likes

Total Posts

1,077 posts

Correct Reply

155 solutions
Top badges earned
Springboard
Validate 1
Ignite 3
Ignite 1
Establish
View profile
Magus069
MVP

26-04-2016

Hi there,

you can directly use the setInstances method of the instanceManager like the following :

Hope this will help you!

Answers (1)

Answers (1)

Avatar

Avatar
Validate 10
Level 3
Geckoz100
Level 3

Likes

20 likes

Total Posts

143 posts

Correct Reply

3 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 10
View profile

Avatar
Validate 10
Level 3
Geckoz100
Level 3

Likes

20 likes

Total Posts

143 posts

Correct Reply

3 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 10
View profile
Geckoz100
Level 3

27-04-2016

That worked like a charm!  That's what happens when you learn to script through the school of hard knocks, just fumbling your way through it -- I just had to teach myself javascript, so I never discovered this function before.  Really appreciate the help.