Difference between revisions of "RowID"
From Roll20 Wiki
Andreas J. (Talk | contribs) m |
(Added further details on the format of RowID, obtained from running experiments in the sheet sandbox) |
||
(2 intermediate revisions by one user not shown) | |||
Line 2: | Line 2: | ||
[[RowID]] is the unique ID each item in a [[Repeating Section]] has, which can be used to reference it in [[macros]] and [[APIs]] even if the section's rows are reordered. | [[RowID]] is the unique ID each item in a [[Repeating Section]] has, which can be used to reference it in [[macros]] and [[APIs]] even if the section's rows are reordered. | ||
+ | |||
+ | Preliminary testing have shown that: | ||
+ | * RowID must be strings, exactly 20 character long, and with a mandatory leading <code>-</code> at the front. This leaves 19 variable characters. | ||
+ | * Multiple <code>-</code> characters can appear next to each other. The following RowID is valid: <code>--------------------</code> | ||
+ | * While Roll20 itself might generate RowID with mixed upper- and lower-case, [[Sheet Worker Scripts#setAttrs|setAttrs()]], [[Sheet_Worker_Scripts#Events|Sheet worker Events]] and [[Macro#Attribute_Macros|attribute macros]] (at least) are case insensitive. If you generate RowID, it is probably best to use all-lowercase. | ||
+ | ** TODO: confirm whether Roll20 still generate RowID with upper-case letters | ||
+ | * While Roll20 seems to only generate RowID using the characters in <code>[0-9a-z-]</code>, it seems any UTF-16 Code Unit is valid. The length above is measured in UTF-16 code units, as javascript does when using [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length String.length] in sheetworkers. See [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String#utf-16_characters_unicode_code_points_and_grapheme_clusters Mozilla Developer Network documentation] on strings in javascript for details. | ||
+ | ** For compatibility with [[Macros]], it is probably best to not use any ASCII character other that digits, letters and dashes. While it seems possible to create a row with RowID <code>-0123456789abcde@{}</code> with [[Sheet Worker Scripts#setAttrs|setAttrs()]], the RowID is likely incompatible with macros. | ||
+ | ** To get a valid UTF-16 string, avoiding surrogate pairs of UTF-16 (see documentation above) might be advisable. Otherwise, care must be taken to pair them correctly. | ||
+ | |||
+ | |||
+ | ''See Also:'' '''[[RowIndex]]''' | ||
Macros: | Macros: | ||
Line 9: | Line 21: | ||
Character Sheet Development: | Character Sheet Development: | ||
* [[Sheet Worker Scripts]] there are some functions for interacting with rep sections by RowID | * [[Sheet Worker Scripts]] there are some functions for interacting with rep sections by RowID | ||
+ | * [[Character_Sheet_Development/Bugs#Repeating_Sections|Known Quirks & Bugs related to Repeating Sections & RowID]] | ||
API Development: | API Development: |
Latest revision as of 10:06, 5 November 2023
Page Updated: 2023-11-05 |
Character Sheet Development
Getting Started
- Using Custom Sheets
- Building Sheets
(Main Page) - Glossary
- Code Restrictions
- Best Practice
- Common Mistakes
- Tutorials
- Examples, Templates
- Pattern Libraries
- HTML & storing data
- CSS & Styling
General
- Updates & Changelog
- Known Bugs
- Character Sheet Enhancement(CSE)
- Custom Roll Parsing
- Legacy Sheet(LCS)
- Beacon SDK
Reference
- Buttons
- Repeating Sections
- Sheetworkers
- Roll Templates
- sheet.json
- Translation
- Auto-Calc
- Advanced
- All SheetDev Pages
Tools & Tips
Other
This article is a stub. |
Preliminary testing have shown that:
- RowID must be strings, exactly 20 character long, and with a mandatory leading
-
at the front. This leaves 19 variable characters. - Multiple
-
characters can appear next to each other. The following RowID is valid:--------------------
- While Roll20 itself might generate RowID with mixed upper- and lower-case, setAttrs(), Sheet worker Events and attribute macros (at least) are case insensitive. If you generate RowID, it is probably best to use all-lowercase.
- TODO: confirm whether Roll20 still generate RowID with upper-case letters
- While Roll20 seems to only generate RowID using the characters in
[0-9a-z-]
, it seems any UTF-16 Code Unit is valid. The length above is measured in UTF-16 code units, as javascript does when using String.length in sheetworkers. See Mozilla Developer Network documentation on strings in javascript for details.- For compatibility with Macros, it is probably best to not use any ASCII character other that digits, letters and dashes. While it seems possible to create a row with RowID
-0123456789abcde@{}
with setAttrs(), the RowID is likely incompatible with macros. - To get a valid UTF-16 string, avoiding surrogate pairs of UTF-16 (see documentation above) might be advisable. Otherwise, care must be taken to pair them correctly.
- For compatibility with Macros, it is probably best to not use any ASCII character other that digits, letters and dashes. While it seems possible to create a row with RowID
See Also: RowIndex
Macros:
Character Sheet Development:
- Sheet Worker Scripts there are some functions for interacting with rep sections by RowID
- Known Quirks & Bugs related to Repeating Sections & RowID
API Development: