Character Vault
Any Concept / Any System
Compendium
Your System Come To Life
Roll20 for Android
Streamlined for your Tablet
Roll20 for iPad
Streamlined for your Tablet

Personal tools

Difference between revisions of "RowID"

From Roll20 Wiki

Jump to: navigation, search
m
(Added further details on the format of RowID, obtained from running experiments in the sheet sandbox)
 
(One intermediate revision 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]]'''
 
''See Also:'' '''[[RowIndex]]'''
  
Line 10: 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

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 - 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.


See Also: RowIndex

Macros:

Character Sheet Development:

API Development: