## Dungeons and Dragons Characters
```base
filters:
and:
- file.hasTag("Character")
- or:
- note["Born (Harptos)"]
- note["Born (NY)"]
- note["Born (VRCY)"]
formulas:
currentHarptos: date("1494-12-20")
relHarptosExists: if(note["Born (Harptos - Relative)"].isEmpty(),false,true)
notBorn: if(note["Born (NY)"] || (note["Born (Harptos)"] - formula.currentHarptos).milliseconds < 0,false,true)
nyAge: (date("3859-12-30") - date(note["Born (NY)"])) + (formula.currentHarptos - date("0001-01-01"))
vrcyAge: if( Status != "Dead" && date(formula.currentHarptos.year + "-" + note["Born (VRCY)"].split("/")[0] + "-" + note["Born (VRCY)"].split("/")[1]) <= formula.currentHarptos, (35000 + formula.currentHarptos.year - number(note["Born (VRCY)"].split("/")[2])).toString() + " years", if(Status != "Dead", (35000 + formula.currentHarptos.year - 1 - number(note["Born (VRCY)"].split("/")[2])).toString() + " years", "") )
vrcyBirthday: note["Born (VRCY)"] + " (VRCY)"
harptosAge: formula.currentHarptos - note["Born (Harptos)"]
harptosAgeFloor: (formula.currentHarptos - note["Born (Harptos)"]).years.floor()
harptosAgeCalc: if(formula.harptosAgeFloor <= 0,formula.harptosAge,formula.harptosAgeFloor + " years")
relAge: formula.currentHarptos - note["Born (Harptos - Relative)"]
relAgeFloor: (formula.currentHarptos - note["Born (Harptos - Relative)"]).years.floor()
relAgeCalc: if(formula.relAgeFloor <= 0,formula.relAge,formula.relAgeFloor)
age_in_years: if(file.hasProperty("Born (Harptos)") && formula.notBorn == false,formula.harptosAgeCalc,if(file.hasProperty("Born (VRCY)"),formula.vrcyAge,if(file.hasProperty("Born (NY)"),formula.nyAge,"Born in "+formula.harptosAgeCalc)))
rel_age_in_years: if(formula.relHarptosExists && note["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["Born (VRCY)"],formula.vrcyBirthday,if(note["Born (Harptos)"],note["Born (Harptos)"].format("MM/DD/YYYY") + " (Harptos)",note["Born (NY)"].format("MM/DD/YYYY") + " (NY)"))
deathDate: if(note["Death Date (Harptos)"],note["Death Date (Harptos)"],note["Death Date (NY)"])
deathAgeInclRel: if(Status != "Dead",formula.rel_age_in_years,note["Death Age - Relative"] + " (Truly " + note["Death Age"] + ", Died " + formula.deathDate.format("MM/DD/YYYY") + ")")
ageInclStatus: if(Status != "Dead",formula.age_in_years_incl_rel,if(formula.relHarptosExists,formula.deathAgeInclRel,note["Death Age"] + " (Died " + formula.deathDate.format("MM/DD/YYYY") + ")"))
sort: if(Status == "Dead" && formula.relHarptosExists,note["Death Age - Relative"],if(Status == "Dead",note["Death Age"],if(formula.relHarptosExists,formula.relAge,if(note["Born (Harptos)"],formula.harptosAge,(if(note["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["Born (AR)"]
formulas:
currentAR: date("4720-11-13")
ARage: formula.currentAR - note["Born (AR)"]
ARageFloor: (formula.currentAR - note["Born (AR)"]).years.floor()
ARageCalc: if(formula.ARageFloor <= 0,formula.ARage,formula.ARageFloor + " years")
notBorn: if((note["Born (AR)"] - formula.currentAR).milliseconds < 0,false,true)
age_in_years: if(formula.notBorn == false,formula.ARageCalc,"Born in "+formula.ARageCalc)
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["Born (AR)"]:
displayName: Born (AR)
formula.ageInclStatus:
displayName: Age as of 11/13/4720
views:
- type: table
name: Table
order:
- file.name
- formula.ageInclStatus
- Born (AR)
sort:
- column: formula.formatted_age
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)"]'
yearBornText: note["Year Born (GSC)"].toString()
yearBornLength: formula.yearBornText.length
yearBorn: if(formula.yearBornLength == 8,number(formula.yearBornText.slice(0,4)),if(formula.yearBornLength == 7,number(formula.yearBornText.slice(0,3)),if(formula.yearBornLength == 6,number(formula.yearBornText.slice(0,2)),number(formula.yearBornText.slice(0,1)))))
campaignAge: if(note["Day Born (GSC)"] >= formula.currentDay,(formula.yearBorn - formula.currentYear),(formula.yearBorn - (formula.currentYear + 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:
- column: formula.campaignAge
direction: DESC
columnSize:
file.name: 240
```
## All Birthdays
```base
filters:
and:
- file.hasTag("Character")
formulas:
birthday: if(note["Born (Harptos)"],note["Born (Harptos)"],if(note["Born (AR)"],note["Born (AR)"],if(note["Day Born (GSC)"],note["Day Born (GSC)"],if(note["Born (VRCY)"],note["Born (VRCY)"],note["Born (NY)"]))))
realm: if(note["Born (Harptos)"],"(Harptos)",if(note["Born (AR)"],"(Absalom Reckoning)",if(note["Day Born (GSC)"],"(GSC)",if(note["Born (VRCY)"],"(VRCY)","(NY)"))))
formattedBirthdayMMDD: if(note["Born (VRCY)"],note["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["Born (VRCY)"],note["Born (VRCY)"].split("/")[0],(formula.birthday).format("MM"))
day: if(note["Born (VRCY)"],note["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
```