
Hello, everyone!
I am updating a sheet and need help regarding the Sheet Worker. I have manged to copy all old attributes to new attributes, except for the attributes in repeating sections. I've tried looking for inspiration in almost every character sheet that gets attribute data from a repeating section, but to no avail. It simply does not create or copy of the rows with data in it.
What I want to do:
Copy attribute data from a repeating section with old attribute names to a repeating section with new attribute names for backwards-compatability.
How I test it:
In the sheet with the old code I have added two rows of simple text to a repeating-section (by clicking "Add" on the character sheet). I then update with new code and open the character sheet to see if the two rows with text have been added. If I return to old code, I still see the added rows.
I tried doing different things, and I simply don't know how to proceed, and hopefully someone here can help.
The old code is not done by me, so also let me know if there are any problems there that prevents me from doing what I want.
Snippet of fieldset/repeating-class from the Old sheet:
In the script there are of course also all the other attributes, which works fine, except for the repeating-sections.
I am updating a sheet and need help regarding the Sheet Worker. I have manged to copy all old attributes to new attributes, except for the attributes in repeating sections. I've tried looking for inspiration in almost every character sheet that gets attribute data from a repeating section, but to no avail. It simply does not create or copy of the rows with data in it.
What I want to do:
Copy attribute data from a repeating section with old attribute names to a repeating section with new attribute names for backwards-compatability.
How I test it:
In the sheet with the old code I have added two rows of simple text to a repeating-section (by clicking "Add" on the character sheet). I then update with new code and open the character sheet to see if the two rows with text have been added. If I return to old code, I still see the added rows.
I tried doing different things, and I simply don't know how to proceed, and hopefully someone here can help.
The old code is not done by me, so also let me know if there are any problems there that prevents me from doing what I want.
Snippet of fieldset/repeating-class from the Old sheet:
<fieldset class="repeating_krits"> <table> <tr class="sheet-bb"> <td> <input type="text" name="attr_krit-skador" value="0"> </td> </tr> </table> </fieldset>Snippet of fieldset/repeating-class from New sheet:
<fieldset class="repeating_crits"> <table> <tr class="bb"> <td> <input type="text" name="attr_crit-injury"> </td> </tr> </table> </fieldset>Snippet of Sheet Worker script:
<script type="text/worker"> on('sheet:opened', function() { //crit-injury getAttrs(["repeating_crits_crit-injury", "repeating_krits_krit-skador"], function(v) { setAttrs({ repeating_crits_crit-injury: v.repeating_krits_krit-skador }); }); }); </script>This is just how it looks right now, I've tried a ton of different formats.
In the script there are of course also all the other attributes, which works fine, except for the repeating-sections.