## Dungeons and Dragons Characters
```base
filters:
and:
- file.hasTag("Character")
- or:
- note["date born (harptos)"]
- note["date born (ny)"]
- note["date born (vrcy)"]
- '!file.inFolder("z_Templates")'
formulas:
currentHarptos: date("1494-12-20")
relHarptosExists: if(note["date born (harptos - relative)"].isEmpty(),false,true)
notBorn: if(note["date born (ny)"] || (note["date born (harptos)"] - formula.currentHarptos).milliseconds < 0,false,true)
nyAge: (date("3859-12-30") - date(note["date born (ny)"])) + (formula.currentHarptos - date("0001-01-01"))
vrcyAge: if( status != "Dead" && date(formula.currentHarptos.year + "-" + note["date born (vrcy)"].split("/")[0] + "-" + note["date born (vrcy)"].split("/")[1]) <= formula.currentHarptos, (35000 + formula.currentHarptos.year - number(note["date born (vrcy)"].split("/")[2])).toString() + " years", if(status != "Dead", (35000 + formula.currentHarptos.year - 1 - number(note["date born (vrcy)"].split("/")[2])).toString() + " years", "") )
vrcyBirthday: note["date born (vrcy)"] + " (VRCY)"
harptosAge: formula.currentHarptos - note["date born (harptos)"]
harptosAgeFloor: (formula.currentHarptos - note["date born (harptos)"]).years.floor()
harptosAgeCalc: if(formula.harptosAgeFloor <= 0,formula.harptosAge,formula.harptosAgeFloor + " years")
harptosUntilBorn: note["date born (harptos)"] - formula.currentHarptos
relAge: formula.currentHarptos - note["date born (harptos - relative)"]
relAgeFloor: (formula.currentHarptos - note["date born (harptos - relative)"]).years.floor()
relAgeCalc: if(formula.relAgeFloor <= 0,formula.relAge,formula.relAgeFloor)
age_in_years: if(file.hasProperty("date born (harptos)") && formula.notBorn == false,formula.harptosAgeCalc,if(file.hasProperty("date born (vrcy)"),formula.vrcyAge,if(file.hasProperty("date born (ny)"),formula.nyAge,"Born in "+formula.harptosUntilBorn)))
rel_age_in_years: if(formula.relHarptosExists && note["date born (harptos)"],formula.relAgeCalc,formula.age_in_years)
age_in_years_incl_rel: if(formula.relHarptosExists,formula.rel_age_in_years + " (Truly " + formula.age_in_years + ")",formula.age_in_years)
birthday: if(note["date born (vrcy)"],formula.vrcyBirthday,if(note["date born (harptos)"],note["date born (harptos)"].format("MM/DD/YYYY") + " (Harptos)",note["date born (ny)"].format("MM/DD/YYYY") + " (NY)"))
deathDate: note["death date (harptos)"]
ageInclStatus: if(status != "Dead",formula.age_in_years_incl_rel,note["death age"] + " (Died " + formula.deathDate.format("MM/DD/YYYY") + ")")
sort: if(status == "Dead",note["death age"],(if(formula.relHarptosExists,formula.relAge,if(note["date born (harptos)"],formula.harptosAge,(if(note["date born (vrcy)"],formula.vrcyAge,formula.nyAge))))))
properties:
file.name:
displayName: Character
formula.birthday:
displayName: Birthday
formula.ageInclStatus:
displayName: Age as of 12/20/1494
views:
- type: table
name: Table
order:
- file.name
- formula.ageInclStatus
- formula.birthday
sort:
- property: formula.sort
direction: DESC
columnSize:
file.name: 265
formula.ageInclStatus: 184
```
## Pathfinder Characters
```base
filters:
and:
- file.hasTag("Character")
- note["date born (ar)"]
formulas:
currentAR: date("4720-11-13")
ARage: formula.currentAR - note["date born (ar)"]
ARageFloor: (formula.currentAR - note["date born (ar)"]).years.floor()
ARageCalc: if(formula.ARageFloor <= 0,formula.ARage,formula.ARageFloor + " years")
ARuntilBorn: note["date born (ar)"] - formula.currentAR
notBorn: if((note["date born (ar)"] - formula.currentAR).milliseconds < 0,false,true)
age_in_years: if(formula.notBorn == false,formula.ARageCalc,"Born in "+formula.ARuntilBorn)
ageInclStatus: if(status != "Dead",formula.age_in_years,note["death age"] + " (Died " + note["death date (ar)"].format("MM/DD/YYYY") + ")")
sort: if(status == "Dead",note["death age"],formula.ARage)
properties:
file.name:
displayName: Character
note["date born (ar)"]:
displayName: Born (AR)
formula.ageInclStatus:
displayName: Age as of 11/13/4720
views:
- type: table
name: Table
order:
- file.name
- formula.ageInclStatus
- date born (ar)
sort:
- column: formula.sort
direction: DESC
columnSize:
file.name: 240
```
## Star Wars Characters
```base
filters:
and:
- file.hasTag("Character")
- note["year born (gsc)"]
formulas:
currentDay: number(133)
currentYear: number(-14)
birthday: '"Day " + note["day born (gsc)"] + ", " + note["year born (gsc)"]'
yearBorn: number(note["year born (gsc)"].slice(0,note["year born (gsc)"].length - 4)) * if(note["year born (gsc)"].contains("BBY"),-1,1)
campaignAge: if(note["day born (gsc)"] <= formula.currentDay,formula.currentYear - formula.yearBorn,formula.currentYear - formula.yearBorn - 1)
ageInclStatus: if(status != "Dead",formula.campaignAge,note["death age"] + " (Died Day " + note["death day (gsc)"] + ", " + note["death year (gsc)"] + ")")
properties:
file.name:
displayName: Character
formula.birthday:
displayName: Born (GSC)
formula.campaignAge:
displayName: "Age as of Day 133, 14 BBY"
views:
- type: table
name: Table
order:
- file.name
- formula.campaignAge
- formula.birthday
sort:
- property: formula.campaignAge
direction: DESC
columnSize:
file.name: 240
```
## All Birthdays
```base
filters:
and:
- file.hasTag("Character")
- '!file.inFolder("z_Templates")'
formulas:
birthday: if(note["date born (harptos)"],note["date born (harptos)"],if(note["date born (ar)"],note["date born (ar)"],if(note["day born (gsc)"],note["day born (gsc)"],if(note["date born (vrcy)"],note["date born (vrcy)"],note["date born (ny)"]))))
realm: if(note["date born (harptos)"],"(Harptos)",if(note["date born (ar)"],"(Absalom Reckoning)",if(note["day born (gsc)"],"(GSC)",if(note["date born (vrcy)"],"(VRCY)","(NY)"))))
formattedBirthdayMMDD: if(note["date born (vrcy)"],note["date born (vrcy)"].split("/").slice(0,2).join("/") + " " + formula.realm,(formula.birthday).format("MM/DD") + " " + formula.realm)
formattedBirthdayDD: '"Day " + formula.birthday + " " + formula.realm'
formatted_birthday: if(note["day born (gsc)"],formula.formattedBirthdayDD,formula.formattedBirthdayMMDD)
month: if(note["date born (vrcy)"],note["date born (vrcy)"].split("/")[0],(formula.birthday).format("MM"))
day: if(note["date born (vrcy)"],note["date born (vrcy)"].split("/")[1],formula.birthday.format("DD"))
dayOfYear: ((number(formula.month)-1) * 30) + number(formula.day)
birthDayOfYear: if(note["day born (gsc)"],note["day born (gsc)"],formula.dayOfYear)
properties:
file.name:
displayName: Character
formula.formatted_birthday:
displayName: Birthday
views:
- type: table
name: Table
order:
- file.name
- formula.formatted_birthday
sort:
- property: formula.birthDayOfYear
direction: ASC
columnSize:
file.name: 270
```