You can also create IDs based on a counter, so you can be sure to avoid 
name conflicts, and each tiddler will be given a unique ID (even one that 
does not have a created field). In this case, also modify the body of the 
generateID function and the filterAlreadyRenamed filter.

var filterAlreadyRenamed = "!regexp[^ZK\\d{8}$]";

// ...

var lastId = 
(parseInt($tw.wiki.filterTiddlers("[regexp[^ZK\\d{8}$]nsort[]last[]removeprefix[ZK]]")[0])
 
+ 1) || 1;
function generateId(fields) {
  var idLength = 8;
  var idPrefix = "ZK";
  var id = lastId.toString();
  lastId += 1;
  while (id.length < idLength) id = "0" + id;
  return idPrefix + id;
}

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/a134b1a5-9777-4a4f-a2c0-0fb7ed666192n%40googlegroups.com.

Reply via email to