Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Advertisement Create a free account

[Splittermond] Wrong Row ID?

1626780316
Loki
Pro
Sheet Author
Hi, the following code: getSectionIDs("repeating_masteries", function(idarray) { for(var i=0; i < idarray.length; i++) { removeRepeatingRow("repeating_masteries_" + idarray[i]); } }); getSectionIDs("repeating_combatmasteries", function(idarray) { for(var i=0; i < idarray.length; i++) { removeRepeatingRow("repeating_combatmasteries" + idarray[i]); } }); getSectionIDs("repeating_magicmasteries", function(idarray) { for(var i=0; i < idarray.length; i++) { removeRepeatingRow("repeating_magicmasteries" + idarray[i]); } }); results in multiple errors of this kind: SHEET WORKER ERROR: You attempted to delete a repeating row but passed an invalid row ID in repeating_combatmasteries-mf2zbqw0zrsxaql-wfu_ SHEET WORKER ERROR: You attempted to delete a repeating row but passed an invalid row ID in repeating_meisterschaftenmagie-mf2biyqgsgi7vx8bchj_ The code simply deletes all the repeating sections in order to import a new character via json file. The removeRepeatingRow works on the first repeating section repeating_masteries but not on the other two. I've tried to figure out the problem but unsuccessful yet. Does anyone have an idea? Greetings!
1626792590
Finderski
Pro
Sheet Author
Compendium Curator
Have you tried something like this: getSectionIDs("repeating_masteries", function(idarray) { for(var i=0; i < idarray.length; i++) { removeRepeatingRow("repeating_masteries_" + idarray[i]); } getSectionIDs("repeating_combatmasteries", function(idarray) { for(var i=0; i < idarray.length; i++) { removeRepeatingRow("repeating_combatmasteries" + idarray[i]); } getSectionIDs("repeating_magicmasteries", function(idarray) { for(var i=0; i < idarray.length; i++) { removeRepeatingRow("repeating_magicmasteries" + idarray[i]); } }); }); });
1626827630

Edited 1626827930
I think you're missing an underscore on the second two - as you can see from the log, the section name is running straight into the rowID. I would personally recommend trying to use template literals for attribute strings, I find it easier to see the output string & spot errors than using the + operator. But that might just be me :) getSectionIDs("repeating_magicmasteries", function(idarray) { for(var i=0; i < idarray.length; i++) { removeRepeatingRow(`repeating_magicmasteries_${idarray[i]}`); } });
1626873699
Finderski
Pro
Sheet Author
Compendium Curator
Nice catch, Oosh
1626904880
Loki
Pro
Sheet Author
Thank you, Oosh! That was indeed the problem. :-) And also thank you for the trick with the template literals, it looks like it was very handy! Also thank you, Finderski for your time! :) Greetings!