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

Repeating section - entries duplicates bordered red

1631917640
Jiboux
Pro
Sheet Author
Compendium Curator
Hello all, So after months of development, I have finally reached the step of loading my sheet for the first time on my live game... And found out that in the conversion process from the older version to the new one, several repeating section items now appeared twice, with the second instance bordered in red... I was convinced that when this happened you would just delete the second instance, but just realized that you can't, it actully deletes both... How do you solve this, and what does it mean that an entry got duplicated. Thanks for the help
1631918901
Finderski
Pro
Sheet Author
Compendium Curator
Hard to say without seeing the code and possibly the code from the original sheet. I've never had that happen.
1631920701
Jiboux
Pro
Sheet Author
Compendium Curator
i'm currently investigating the code, and this narrows down to entries where I write with a sheetworker... Maybe something to do with vandalized rowids... But without seeing the code, the red border comes from a CSS coming from roll20 .repitembroken, do you know what type of logic flags a repitem as being broken ?
1631923208
Oosh
Sheet Author
API Scripter
I think if a repitem is created, but holds no valid attributes, it will be red-bordered? I'm not sure what else will result in that. As Finderski said, we might need your related sheetworker code. You can also check via the browser console what attributes have been created for the section (you can also do this via API scripts if you wish): Campaign.characters.get('-CHARID').attribs.models.filter(a=>a.attributes.name.match(/repeating_SECNAME/i)) Replacing -CHARID with the ID of the character, and SECNAME with the repeating section name. If you just want the names and don't care about values, chuck a map on the end: Campaign.characters.get('-CHARID').attribs.models.filter(a=>a.attributes.name.match(/repeating_SECNAME/i)).map(a=>a.attributes.name) You should be able to see if your sheetworkers are generating bogus attribute names.
1631924078
Jiboux
Pro
Sheet Author
Compendium Curator
Well this part of the code is pretty long... I can still try to copy part of it, but there is a lot of custom functions that make it hardly readable for someone not involved: So basically, this is an import from an old version of my sheet, to a new version... I get through all the entries (karray is the result of a getsectionID) and look if they have a "Link" (which is a cross reference between 2 repitems, possibly from different sections) buildPre is a function that helps building the prefix for my repitems (they are like repeating_talents_thisistherowid_T_Name). So I have a pre (the item that I am currently updating), and a pre2(the item it links to), and for each prefix, because getsetctionID returned a vandalized rowID, I have the vandalized and non-vandalized version of the prefix (gosh I hate this vandalization stuff... I first suspected it was the source) repeatSection is a function that returns one of the sections between underscores of repeating_talents_thisistherowid_T_Name, so that I can find the rowid from a fullname, or the code. Finally values is what I got from my getAttrs, and vals is the array that I will feed at the end my function to setAttrs //Knacks                             for( i = 0; i < karray.length; i++ ){                               newflags=updateRow( "NAC", karray[i],newflags);                               //Link import logic is buggy                               let prev=buildPre("NAC", karray[i]), //vandalized                               pre=buildPre("NAC",values[prev+"RowID"]); //non vandalized                               let links = values[prev+"Linked"];                               if (links){ // This section is for importing links. Up to v2, only Knacks had links and links were unidirectional                                  log ("links before sanitizing" + links) ;                                 links = links.replace( /[\{|\(|\)|\@|\}]/gi, ""); //Sanitizing.links if it exists is in the form of an autocalc i.e (@{fully_qualifiedname}+@{fully_qualifiedname}). After sanitizing they will be fully_qualifiedname+fully_qualifiedname                                 linkArray=links.split("+");// Now we split the list by +, so we get an array [ fully_qualifiedname,fully_qualifiedname]                                 for(j=0;j<linkArray.length;j++){                                   if(linkArray[j].startsWith("repeating")){ //Non Spellcasting Talents are on the repeating_XXX-RowId format                                     let rid= repeatSection(2,linkArray[j]);                                     let pre2v=buildPre(repeatSection(3,linkArray[j]),rid.toLowerCase()), // Really don't know why, but we need a vandalized rowid                                     pre2=buildPre(repeatSection(3,linkArray[j]),rid)                                     let tal= values[pre2v+"Name"];                                                                log("tal " +tal + " pre " +pre + " prev " +prev+ " pre2 "+pre2 + " pre2v" +pre2v);                                                                if(! tal)  log ("Earthdawn: UpdateCharacterSheet - Tried to create a link to an ability that doesn't exist: " + rid); // This line is to get rid of dead links...                                     else {if (!linkArray[j].endsWith("Mods") && tal!==undefined && repeatSection(3,linkArray[j])!=="NAC"){ //Links with Talents and Weapons have 2 entries, so one of them has to be skipped                                       if(!vals[pre+"LinksGetValue_max"]){//This is the first link to be created                                         vals[pre+"LinksGetValue_max"]=pre2+"Effective-Rank"                                         vals[pre+"LinksGetValue"]=tal;                                       }                                       else {                                         vals[pre+"LinksGetValue_max"]+=","+pre2+"Effective-Rank"                                         vals[pre+"LinksGetValue"]+=","+tal;                                       }   //that's an addition link                                       if(!vals[pre2+"LinksProvideValue_max"]){//This is the first link to be created                                         vals[pre2+"LinksProvideValue_max"]="NAC;"+karray[i];                                       }                                       else {                                         vals[pre2+"LinksProvideValue_max"]+=",NAC;"+karray[i];                                       }   //that's an addition link                                     }                                   }                                 }                               }                             }                             newflags=addAPIflag( newflags, "RemoveAttr", pre+"Linked" );                             newflags=addAPIflag( newflags, "RemoveAttr", pre+"LinkDisplay" );                           };