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 .
×
Create a free account

Handling a fix for repeating sections with the sames name

1485995152
David
Sheet Author
On the Saga of the Icelanders character sheet the Moves and Relationship repeating sections  have the same attribute name.  This is easy to fix , but whats the best way of handling this as just renaming them could mean existing  users could loose entries.
1485996354
Kryx
Pro
Sheet Author
API Scripter
I have found no issue with different repeating sections having the same field name. I use it quite a bit actually. If you're going to change it then the best method is to change it in the html and then use sheet workers to adjust existing data. if field a exists in repeating section then make field b equal to a and then set a to null.
I think he means they have the same class name, which would be problematic. There are 13 instances on the sheet of <fieldset class="repeating_skills">.
1486011032
vÍnce
Pro
Sheet Author
We have had issues on the PF sheet with repeating fieldsets that have the same attributes names.  Mostly it involved sheet workers incorrectly(or correctly depending on your perspective...) triggering events.  We have changed all of our attributes to be unique in/out of fieldsets.  As Kryx suggested you would need to make some type of migration routine that converts the attributes.  Might have to detect old vs new sheet as well with a version function.  Some other gurus would have to post specifics though. I just break things.  ;-)
1486024458
David
Sheet Author
Rabulias said: I think he means they have the same class name, which would be problematic. There are 13 instances on the sheet of <fieldset class="repeating_skills">. Yes the class name is the issue not the attribute.
1486026818
David
Sheet Author
I don't know how attributes in a repeating section are stored but is the class name not involved in some way so if I change the class name will the existing data not stay attached to the original class name.
1486027360

Edited 1486027471
Jakob
Sheet Author
API Scripter
Kryx said: Class names of HTML elements are not stored by roll20 at all. Still, if you change the class name of a repeating section, the existing attributes in that section will become effectively inaccessible without some kind of migration method. If you change repeating_wazzle to repeating_snuffle, all the old user data is in attributes like repeating_wazzle_-Abc123_name, and the only way to see them is manually: @{repeating_wazzle_-Abc123_name} (since they are even hidden in the attributes & abilities tab)
1486028113

Edited 1486028258
Kryx
Pro
Sheet Author
API Scripter
Ah, I thought repeating sections were stored by name="", not a class name. My mistake. If you change a repeating section's class name then you'll definitely encounter problems. You'll have to use sheetworkers to migrate the data.
1486039668

Edited 1486039823
David
Sheet Author
Jakob said: Kryx said: Class names of HTML elements are not stored by roll20 at all. Still, if you change the class name of a repeating section, the existing attributes in that section will become effectively inaccessible without some kind of migration method. If you change repeating_wazzle to repeating_snuffle, all the old user data is in attributes like repeating_wazzle_-Abc123_name, and the only way to see them is manually: @{repeating_wazzle_-Abc123_name} (since they are even hidden in the attributes & abilities tab) Thats is what I thought and was as asking about best practice. I take it the best way to do this is create a onchange sheet worker that cycles thru existing repeating sections and create  rows in the new repeating section (can this be done in a sheet worker) and migrate the data, then hide the old sections. 
1486045800
Kryx
Pro
Sheet Author
API Scripter
You should probably do it on sheet open, but the rest is the same, ya. Keep in mind sheets have to be opened for it to trigger.
1486055212
David
Sheet Author
ok thanks.
1486089048
Lithl
Pro
Sheet Author
API Scripter
Kryx said: Ah, I thought repeating sections were stored by name="", not a class name. My mistake. Technically, Roll20 doesn't store anything about class names. However, when you create a fieldset with class="repeating_X", at render time that fieldset gets display:none, and a div is created with data-groupname="repeating_X". Technically , the groupname attribute is being stored, but the groupname's value is being set by a class in the source. =)