Hello i was trying to solve this issue on my Notion database,
What i am trying to accomplish is to have a code that shows me the latest read chapter in the database. The difference between a read/unread chapter is the status field i put up (it is a basic boolean figure if you read it you click on the checkmark that turns the 0-1 ) I have done a similar database structure/configuration with the episodes that has been watched. It was easy to do because there are no irregularities and all of them are in integer values such as ep1,ep2 i just wrote a formula to find the total checked(watched) episode numbers . I could have also done it as to give me the latest input (episode) that has been watched.
But on manga/comic/books they are not on integer values there are always extras,editoral notes which counts as 1.1,1.2 Example:
read chapters (value checked/true)
Chapter 1 ( status:read = true)
Chapter 2 ( status:read = true)
Chapter 2,1 ( status:read = true)
Chapter 2,2 ( status:read = true)
Chapter 3 ( status:read = false)
If i try the same formula that is in notions system it doesn't give me the right answer because it cannot find/count it like an integer value list. On this example i have 5 values in total 4 that has been checked as read if i try to do count checked values like in episodes it will give me false number like 4.(it has to give me 2,2)
I had no idea about JavaScript so after many trial and errors i have managed to combine to code to give me what i want. The only issue is it only accepts a value but not a changeable property on notion.
Because of the quotation that involves this thing -> ""(Quotation) it is not lining perfectly so i always get the error message saying i should put up a "(" in the code to solve it.Which doesn't make sense because whenever i have tried to put it did not solve my issue
The working version is as follows
replaceAll(replace(prop("all chapter numbers"), "(?:[^,]*,){2}", ""), ",.*", "");
i use prop("all chapter numbers") that shows all the chapters that has been read like (201,202,202.1,202.2,...)
I have used 2 as an example in here that works it just does what it suppose to do. But instead of 2 i need a property value so it changes based up on each book/comic/manga.
i have the total checked/read chapter value stored in a property in a int value like 2,4,5
When i put the property on notion into this code structure it gives me the error and does not accept it. Idk how can i fix this issue
replaceAll(replace(prop("all chapter numbers"), "(?:[^,]*,);{toNumber(prop("total checked chapter"))}",""), ",.*", "");