parent
6e34ae07e3
commit
98f18db119
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,3 @@
|
||||
```dataviewjs
|
||||
dv.view("00.01 Admin/dv-views/query_inv", {tabletype: , invtype: , dateadded: , style: , stage: , ccy: , theme: , tradingd: , tradingp: })
|
||||
```
|
@ -0,0 +1,3 @@
|
||||
```dataviewjs
|
||||
dv.view("00.01 Admin/dv-views/book_query", {sourcetype: , dateadded: , language: , author: , publicationd: , theme: , readingd: })
|
||||
```
|
@ -0,0 +1,21 @@
|
||||
let thisf = dv.current();
|
||||
let {toprint} = input;
|
||||
|
||||
function BuildList(arg1) {
|
||||
let ilength = arg1.length
|
||||
let TempS = ""
|
||||
for (let i = 0; i < ilength; i++) {
|
||||
if (Boolean(arg1[i])) {
|
||||
if (TempS == "") {
|
||||
TempS = arg1[i]
|
||||
} else {
|
||||
TempS = TempS + ", " + arg1[i]
|
||||
}
|
||||
}
|
||||
}
|
||||
return TempS
|
||||
}
|
||||
|
||||
var String2Print = BuildList(toprint)
|
||||
|
||||
dv.paragraph("search terms: " + String2Print);
|
@ -0,0 +1,69 @@
|
||||
var debug = "found"
|
||||
var debugtitle = "string"
|
||||
let curr = dv.current();
|
||||
let {tabletype, invtype, dateadded, style, stage, ccy, theme, tradingd, tradingp} = input;
|
||||
let page = dv.pages()
|
||||
.filter(p => {return !p.file.path.contains('00.') && p.DocType !== undefined && p.DocType !== null && p.DocType.contains('Investment')})
|
||||
|
||||
function PDataCheck(arg1, arg2) {
|
||||
var iarg1 = arg1
|
||||
if (moment(iarg1).isValid()) {iarg1 = arg1.toString()}
|
||||
var iarg2 = arg2
|
||||
if (moment(iarg2).isValid()) {iarg2 = arg2.toString()}
|
||||
if (!Array.isArray(iarg2)) {
|
||||
var resultdc = iarg1.contains(iarg2)
|
||||
} else if (!Array.isArray(iarg1)) {
|
||||
var resultdc = iarg2.contains(iarg1)
|
||||
} else {
|
||||
let count = iarg2.length
|
||||
let tempresult = false
|
||||
for (let i = 0; i < count; i++) {
|
||||
tempresult = tempresult || iarg1.contains(iarg2[i])
|
||||
}
|
||||
var resultdc = tempresult
|
||||
}
|
||||
return resultdc
|
||||
}
|
||||
|
||||
function IsInPSearch(argobj) {
|
||||
if (Boolean(invtype)) {
|
||||
var result_itype = PDataCheck(argobj.Investment.Type, invtype)
|
||||
} else {var result_itype = true}
|
||||
if (Boolean(theme)) {
|
||||
var result_tag = PDataCheck(argobj.Tag, theme)
|
||||
} else {var result_tag = true}
|
||||
if (Boolean(dateadded)) {
|
||||
var result_date = PDataCheck(argobj.Date, dateadded)
|
||||
} else {var result_date = true}
|
||||
if (Boolean(style)) {
|
||||
var result_style = PDataCheck(argobj.Investment.Style, style)
|
||||
} else {var result_style = true}
|
||||
if (Boolean(stage)) {
|
||||
if (argobj.Investment.Stage == undefined) {var result_stage = false} else {
|
||||
var result_stage = PDataCheck(argobj.Investment.Stage, stage)
|
||||
}
|
||||
} else {var result_stage = true}
|
||||
if (Boolean(ccy)) {
|
||||
var result_ccy = PDataCheck(argobj.Investment.Ccy, ccy)
|
||||
} else {var result_ccy = true}
|
||||
if (Boolean(tradingd)) {
|
||||
var result_tradd = PDataCheck(argobj.Trading.PDate, tradingd)
|
||||
} else {var result_tradd = true}
|
||||
if (Boolean(tradingp)) {
|
||||
var result_tradp = PDataCheck(argobj.Trading.PPrice, tradingp)
|
||||
} else {var result_tradp = true}
|
||||
var resultiid = result_itype && result_tag && result_date && result_stage && result_style && result_ccy && result_tradp && result_tradd
|
||||
return resultiid
|
||||
}
|
||||
|
||||
if (page.length > 0 && (tabletype == 'overview')) {
|
||||
dv.table(["Name", "Currency", "Style", "Stage", "Themes"], page
|
||||
.where(p => p && IsInPSearch(p))
|
||||
.sort(p => p.file.name, `asc`)
|
||||
.map(p => [p.file.link, p.Investment.Ccy, p.Investment.Style, p.Investment.Stage, p.Tag]));
|
||||
} else if (page.length > 0 && (tabletype == 'trading')) {
|
||||
dv.table(["Name", "Currency", "Trading date", "Trading price"], page
|
||||
.where(p => p && IsInPSearch(p))
|
||||
.sort(p => p.file.name, `asc`)
|
||||
.map(p => [p.file.link, p.Investment.Ccy, p.Trading.PDate, p.Trading.PPrice]));
|
||||
} else { return '"No result matching your query"'}
|
@ -0,0 +1,89 @@
|
||||
var debug = "found"
|
||||
var debugtitle = "string"
|
||||
let curr = dv.current();
|
||||
let {placetype, dateadded, style, ambiance, area, theme, country, status} = input;
|
||||
let page = dv.pages()
|
||||
.filter(p => {return !p.file.path.contains('00.') && p.DocType !== undefined && p.DocType !== null && p.DocType.contains('Place')})
|
||||
|
||||
function PDataCheck(arg1, arg2) {
|
||||
var iarg1 = arg1
|
||||
if (moment(iarg1).isValid()) {iarg1 = arg1.toString()}
|
||||
var iarg2 = arg2
|
||||
if (moment(iarg2).isValid()) {iarg2 = arg2.toString()}
|
||||
if (!Array.isArray(iarg2)) {
|
||||
var resultdc = iarg1.contains(iarg2)
|
||||
} else if (!Array.isArray(iarg1)) {
|
||||
var resultdc = iarg2.contains(iarg1)
|
||||
} else {
|
||||
let count = iarg2.length
|
||||
let tempresult = false
|
||||
for (let i = 0; i < count; i++) {
|
||||
tempresult = tempresult || iarg1.contains(iarg2[i])
|
||||
}
|
||||
var resultdc = tempresult
|
||||
}
|
||||
return resultdc
|
||||
}
|
||||
|
||||
function IsInPSearch(argobj) {
|
||||
if (Boolean(placetype)) {
|
||||
var result_ptype = PDataCheck(argobj.Place.Type, placetype)
|
||||
} else {var result_ptype = true}
|
||||
if (Boolean(theme)) {
|
||||
var result_tag = PDataCheck(argobj.Tag, theme)
|
||||
} else {var result_tag = true}
|
||||
if (Boolean(dateadded)) {
|
||||
var result_date = PDataCheck(argobj.Date, dateadded)
|
||||
} else {var result_date = true}
|
||||
if (Boolean(ambiance)) {
|
||||
var result_amb = PDataCheck(argobj.Place.SubType, ambiance)
|
||||
} else {var result_amb = true}
|
||||
if (Boolean(style)) {
|
||||
if (argobj.Place.Style == undefined) {var result_style = false} else {
|
||||
var result_style = PDataCheck(argobj.Place.Style, style)
|
||||
}
|
||||
} else {var result_style = true}
|
||||
if (Boolean(area)) {
|
||||
var result_area = PDataCheck(argobj.Place.Location, area)
|
||||
} else {var result_area = true}
|
||||
if (Boolean(country)) {
|
||||
var result_ctry = PDataCheck(argobj.Place.Country, country)
|
||||
} else {var result_ctry = true}
|
||||
if (Boolean(status)) {
|
||||
var result_stat = PDataCheck(argobj.Place.Status, status)
|
||||
} else {var result_stat = true}
|
||||
var resultiid = result_ptype && result_tag && result_date && result_amb && result_style && result_area && result_ctry && result_stat
|
||||
return resultiid
|
||||
}
|
||||
|
||||
let templacetype = GetMainPlaceType(placetype)
|
||||
|
||||
function GetMainPlaceType(arg3) {
|
||||
if (!Array.isArray(arg3)) {
|
||||
return arg3
|
||||
} else {
|
||||
return arg3[0]
|
||||
}
|
||||
}
|
||||
|
||||
if (page.length > 0 && (templacetype == 'Restaurant' || templacetype == 'Brunch')) {
|
||||
dv.table(["Name", "Style", "Cuisine", "Phone", "Email", "Website"], page
|
||||
.where(p => p && IsInPSearch(p))
|
||||
.sort(p => p.file.name, `asc`)
|
||||
.map(p => [p.file.link, p.Place.SubType, p.Place.Style, p.Phone, p.Email, p.Website]));
|
||||
} else if (page.length > 0 && (templacetype == 'Hotel' || templacetype == 'Bar')) {
|
||||
dv.table(["Name", "Type", "Influence", "Phone", "Email", "Website"], page
|
||||
.where(p => p && IsInPSearch(p))
|
||||
.sort(p => p.file.name, `asc`)
|
||||
.map(p => [p.file.link, p.Place.SubType, p.Place.Style, p.Phone, p.Email, p.Website]));
|
||||
} else if (page.length > 0 && (templacetype == 'Sport')) {
|
||||
dv.table(["Name", "Phone", "Email", "Website"], page
|
||||
.where(p => p && IsInPSearch(p))
|
||||
.sort(p => p.file.name, `asc`)
|
||||
.map(p => [p.file.link, p.Phone, p.Email, p.Website]));
|
||||
} else if (page.length > 0 && (templacetype == 'Café')) {
|
||||
dv.table(["Name", "Style", "Phone", "Email", "Website"], page
|
||||
.where(p => p && IsInPSearch(p))
|
||||
.sort(p => p.file.name, `asc`)
|
||||
.map(p => [p.file.link, p.Place.SubType, p.Phone, p.Email, p.Website]));
|
||||
} else { return '"No result matching your query"'}
|
@ -1,70 +1,70 @@
|
||||
var debug = "found"
|
||||
var debugtitle = "string"
|
||||
let curr = dv.current();
|
||||
let {dateadded, language, author, publicationd, theme, readingd} = input;
|
||||
let {tabletype, invtype, dateadded, style, stage, ccy, theme, tradingd, tradingp} = input;
|
||||
let page = dv.pages()
|
||||
.filter(p => {return !p.file.path.contains('00.01') && p.DocType !== undefined && p.DocType !== null && p.DocType.contains('Source') && p.Source.Type !== undefined && p.Source.Type !== null && p.Source.Type.contains('Book')})
|
||||
.filter(p => {return !p.file.path.contains('00.') && p.DocType !== undefined && p.DocType !== null && p.DocType.contains('Investment')})
|
||||
|
||||
function DataCheck(arg1, arg2) {
|
||||
function PDataCheck(arg1, arg2) {
|
||||
var iarg1 = arg1
|
||||
if (moment(iarg1).isValid()) {iarg1 = arg1.toString()}
|
||||
var iarg2 = arg2
|
||||
if (moment(iarg2).isValid()) {iarg2 = arg2.toString()}
|
||||
if (!Array.isArray(iarg2)) {
|
||||
var result = iarg1.contains(iarg2)
|
||||
var resultdc = iarg1.contains(iarg2)
|
||||
} else if (!Array.isArray(iarg1)) {
|
||||
var result = iarg2.contains(iarg1)
|
||||
var resultdc = iarg2.contains(iarg1)
|
||||
} else {
|
||||
let count = iarg2.length
|
||||
let tempresult = false
|
||||
let tempresult2 = false
|
||||
for (let i = 0; i < count; i++) {
|
||||
tempresult = tempresult2 || iarg1.contains(iarg2[i])
|
||||
tempresult2 = tempresult
|
||||
tempresult = tempresult || iarg1.contains(iarg2[i])
|
||||
}
|
||||
var result = tempresult
|
||||
var resultdc = tempresult
|
||||
}
|
||||
return result
|
||||
return resultdc
|
||||
}
|
||||
|
||||
debug = dateadded
|
||||
|
||||
function IsInSearch(book) {
|
||||
function IsInPSearch(argobj) {
|
||||
if (Boolean(invtype)) {
|
||||
var result_itype = PDataCheck(argobj.Investment.Type, invtype)
|
||||
} else {var result_itype = true}
|
||||
if (Boolean(theme)) {
|
||||
var result_tag = DataCheck(book.Tag, theme)
|
||||
var result_tag = PDataCheck(argobj.Tag, theme)
|
||||
} else {var result_tag = true}
|
||||
if (Boolean(dateadded)) {
|
||||
var result_date = DataCheck(book.Date, dateadded)
|
||||
var result_date = PDataCheck(argobj.Date, dateadded)
|
||||
} else {var result_date = true}
|
||||
if (Boolean(language)) {
|
||||
var result_lang = DataCheck(book.Source.Language, language)
|
||||
} else {var result_lang = true}
|
||||
if (Boolean(author)) {
|
||||
var result_auth = DataCheck(book.Source.Author, author)
|
||||
} else {var result_auth = true}
|
||||
if (Boolean(publicationd)) {
|
||||
var result_pub = DataCheck(book.Source.Published, publicationd)
|
||||
} else {var result_pub = true}
|
||||
if (readingd !== undefined && readingd !== null) {
|
||||
if (readingd == true) {
|
||||
var result_read = Boolean(book.Source.Read)
|
||||
} else if (!Boolean(readingd)) {
|
||||
var result_read = !Boolean(book.Source.Read)
|
||||
} else {
|
||||
if (Boolean(book.Source.Read)) {
|
||||
var result_read = DataCheck(book.Source.Read, readingd)
|
||||
} else { var result_read = false}
|
||||
if (Boolean(style)) {
|
||||
var result_style = PDataCheck(argobj.Investment.Style, style)
|
||||
} else {var result_style = true}
|
||||
if (Boolean(stage)) {
|
||||
if (argobj.Investment.Stage == undefined) {var result_stage = false} else {
|
||||
var result_stage = PDataCheck(argobj.Investment.Stage, stage)
|
||||
}
|
||||
} else {var result_read = true}
|
||||
var result = result_tag && result_date && result_lang && result_auth && result_pub && result_read
|
||||
return result
|
||||
} else {var result_stage = true}
|
||||
if (Boolean(ccy)) {
|
||||
var result_ccy = PDataCheck(argobj.Investment.Ccy, ccy)
|
||||
} else {var result_ccy = true}
|
||||
if (Boolean(tradingd)) {
|
||||
var result_tradd = PDataCheck(argobj.Trading.PDate, tradingd)
|
||||
} else {var result_tradd = true}
|
||||
if (Boolean(tradingp)) {
|
||||
var result_tradp = PDataCheck(argobj.Trading.PPrice, tradingp)
|
||||
} else {var result_tradp = true}
|
||||
var resultiid = result_itype && result_tag && result_date && result_stage && result_style && result_ccy && result_tradp && result_tradd
|
||||
return resultiid
|
||||
}
|
||||
|
||||
if (page.length > 0) {
|
||||
dv.table(["Title", "Author", "Published date", "Language", "Themes", "Date read"], page
|
||||
.where(p => p && IsInSearch(p))
|
||||
if (page.length > 0 && (tabletype == 'overview')) {
|
||||
dv.table(["Name", "Currency", "Style", "Stage"], page
|
||||
.where(p => p && IsInPSearch(p))
|
||||
.sort(p => p.file.name, `asc`)
|
||||
.map(p => [p.file.link, p.Investment.Ccy, p.Investment.Style, p.Investment.Stage]));
|
||||
} else if (page.length > 0 && (tabletype == 'trading')) {
|
||||
dv.table(["Name", "Currency", "Trading date", "Trading price"], page
|
||||
.where(p => p && IsInPSearch(p))
|
||||
.sort(p => p.file.name, `asc`)
|
||||
.map(p => [p.file.link, p.Source.Author, p.Source.Published, p.Source.Language, p.Tag, p.Source.Read])); } else { return '"No result matching your query"'}
|
||||
|
||||
dv.paragraph(debug)
|
||||
.map(p => [p.file.link, p.Investment.Ccy, p.Trading.PDate, p.Trading.PPrice]));
|
||||
} else { return '"No result matching your query"'}
|
||||
|
Loading…
Reference in new issue