main
Mel 3 years ago
parent 98f18db119
commit f57bc4a3fc

@ -9,8 +9,8 @@
"state": {
"type": "markdown",
"state": {
"file": "02.02 Paris/@Restaurants Paris.md",
"mode": "preview"
"file": "02.01 London/@Bars London.md",
"mode": "source"
}
}
}
@ -76,7 +76,7 @@
"state": {
"type": "backlink",
"state": {
"file": "02.02 Paris/@Restaurants Paris.md",
"file": "02.01 London/@Bars London.md",
"collapseAll": false,
"extraContext": false,
"sortOrder": "alphabetical",
@ -115,15 +115,15 @@
},
"active": "c1cbd199334b4022",
"lastOpenFiles": [
"02.02 Paris/@Restaurants Paris.md",
"02.02 Paris/@@Paris.md",
"02.02 Paris/Domaine de Courances.md",
"02.02 Paris/@Sport Paris.md",
"02.02 Paris/Haras de la Cense.md",
"02.02 Paris/@Hotels Paris.md",
"02.02 Paris/@Media France.md",
"02.02 Paris/Le Barn.md",
"02.02 Paris/Hotel Amour.md",
"02.02 Paris/@Bars Paris.md"
"02.01 London/@Bars London.md",
"05.01 Computer setup/@Computer Set Up.md",
"02.01 London/@Restaurants London.md",
"03.01 Reading list/@Reading master.md",
"06.02 Investments/Crypto Investments.md",
"06.02 Investments/VC Investments.md",
"06.02 Investments/Equity Investments.md",
"06.02 Investments/JS snippet.md",
"00.01 Admin/Templates/Template Travel.md",
"00.01 Admin/Templates/Template Task.md"
]
}

@ -1,7 +1,3 @@
```dataview
Table without id file.link as "Place", Place.Style as "Theme", Phone, Email, Website from "<% tp.file.folder() %>"
where DocType = "Place"
where contains(Place.Type, "Hotel/Restaurant/Bar/Brunch")
where contains(Place.Location, "Marais")
Where !startswith(file.name, "Template")
```dataviewjs
dv.view("00.01 Admin/dv-views/query_place", {placetype: , dateadded: , style: , ambiance: , area: , theme: , country: , status: })
```

@ -1,6 +1,3 @@
```dataview
Table SourceLink as "Link", PriceValue as "Price Range" from "<% tp.link.folder() %>"
Where DocType = "Product"
Where !startswith(file.name, "Template")
Sort file.name ascending
```dataviewjs
dv.view("00.01 Admin/dv-views/query_product", {prodtype: , dateadded: , prodvalue: , theme: })
```

@ -0,0 +1,508 @@
class globalFunc {
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
}
GetTableHeaders(DataT, TableT) {
let TempData = ["Name"]
switch(DataT) {
case 'Investment':
switch(TableT) {
case 'overview':
TempData = ["Name", "Currency", "Style", "Stage", "Themes"]
break;
case 'trading':
TempData = ["Name", "Currency", "Trading date", "Trading price"]
break;
}
break;
case 'Source':
TempData = ["Title", "Author", "Published date", "Language", "Themes", "Date read"]
break;
case 'Place':
switch(TableT) {
case 'Restaurant':
TempData = ["Name", "Style", "Cuisine", "Phone", "Email", "Website"]
break;
case 'Brunch':
TempData = ["Name", "Style", "Cuisine", "Phone", "Email", "Website"]
break;
case 'Hotel':
TempData = ["Name", "Type", "Influence", "Phone", "Email", "Website"]
break;
case 'Bar':
TempData = ["Name", "Type", "Influence", "Phone", "Email", "Website"]
break;
case 'Sport':
TempData = ["Name", "Phone", "Email", "Website"]
break;
case 'Café':
TempData = ["Name", "Style", "Phone", "Email", "Website"]
break;
}
break;
case 'Product':
TempData = ["Name", "Category", "Link", "Value", "Themes"]
break;
}
return TempData
}
GetTableMap(DataT, TableT, p) {
let TempData = [p.file.link]
switch(DataT) {
case 'Investment':
switch(TableT) {
case 'overview':
TempData = [p.file.link, p.Investment.Ccy, p.Investment.Style, p.Investment.Stage, p.Tag]
break;
case 'trading':
TempData = [p.file.link, p.Investment.Ccy, p.Trading.PDate, p.Trading.PPrice]
break;
}
break;
case 'Source':
TempData = [p.file.link, p.Source.Author, p.Source.Published, p.Source.Language, p.Tag, p.Source.Read]
break;
case 'Place':
switch(TableT) {
case 'Restaurant':
TempData = [p.file.link, p.Place.SubType, p.Place.Style, p.Phone, p.Email, p.Website]
break;
case 'Brunch':
TempData = [p.file.link, p.Place.SubType, p.Place.Style, p.Phone, p.Email, p.Website]
break;
case 'Hotel':
TempData = [p.file.link, p.Place.SubType, p.Place.Style, p.Phone, p.Email, p.Website]
break;
case 'Bar':
TempData = [p.file.link, p.Place.SubType, p.Place.Style, p.Phone, p.Email, p.Website]
break;
case 'Sport':
TempData = [p.file.link, p.Phone, p.Email, p.Website]
break;
case 'Café':
TempData = [p.file.link, p.Place.SubType, p.Phone, p.Email, p.Website]
break;
}
break;
case 'Product':
TempData = [p.file.link, p.Product.Type, p.Product.Link, p.Product.Value, p.Tag]
break;
}
return TempData
}
BuildList(arg1, construct) {
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 + construct + arg1[i]
}
}
}
return TempS
}
Get1stArg(arg3) {
if (!Array.isArray(arg3)) {
return arg3
} else {
return arg3[0]
}
}
IsInSearch(pobj, DocType, darray, iarray) {
let ilength = iarray.length;
let result = true
for (let i = 0; i < iarray.length; i++) {
if (iarray[i] == undefined || darray[i] == undefined) {result = result && true} else {
switch(darray[i]) {
case 'readingd':
if (iarray[i] == true || iarray[i] == false) {result = result && (Boolean(this.GetpProp(pobj, DocType, darray[i])) == iarray[i])} else {
if (Boolean(iarray[i])) {
let pProp = this.GetpProp(pobj, DocType, darray[i])
if (!Boolean(pProp)) { result = result && false } else {
result = result && this.PDataCheck(pProp, iarray[i])
}
} else {result = result && true}
}
break;
default:
if (Boolean(iarray[i])) {
let pProp = this.GetpProp(pobj, DocType, darray[i])
if (!Boolean(pProp)) { result = result && false } else {
result = result && this.PDataCheck(pProp, iarray[i])
}
} else {result = result && true}
break;
}
}
}
return result
}
GetpProp(pobj, DocType, dPoint) {
let result = null
switch(dPoint) {
case 'dateadded':
result = this.GetPoint(pobj, "main", "date")
break;
case 'theme':
result = this.GetPoint(pobj, "main", "tag")
break;
case 'invtype':
case 'sourcetype':
case 'placetype':
case 'prodtype':
result = this.GetPoint(pobj, DocType, "type")
break;
case 'style':
result = this.GetPoint(pobj, DocType, "style")
break;
case 'stage':
result = this.GetPoint(pobj, DocType, "stage")
break;
case 'ccy':
result = this.GetPoint(pobj, DocType, "ccy")
break;
case 'tradingd':
result = this.GetPoint(pobj, DocType, "tradingd")
break;
case 'tradingp':
result = this.GetPoint(pobj, DocType, "tradingp")
break;
case 'language':
result = this.GetPoint(pobj, DocType, "lang")
break;
case 'author':
result = this.GetPoint(pobj, DocType, "author")
break;
case 'publicationd':
result = this.GetPoint(pobj, DocType, "published")
break;
case 'readingd':
result = this.GetPoint(pobj, DocType, "read")
break;
case 'country':
result = this.GetPoint(pobj, DocType, "country")
break;
case 'area':
result = this.GetPoint(pobj, DocType, "location")
break;
case 'ambiance':
result = this.GetPoint(pobj, DocType, "subtype")
break;
case 'status':
result = this.GetPoint(pobj, DocType, "status")
break;
case 'prodvalue':
result = this.GetPoint(pobj, DocType, "value")
break;
}
return result
}
GetPoint(pobj, fstline, dPoint) {
let result = null
switch(fstline) {
case 'main':
switch(dPoint) {
case 'alias':
result = pobj.Alias
break;
case 'tag':
result = pobj.Tag
break;
case 'date':
result = pobj.Date
break;
case 'type':
result = pobj.DocType
break;
case 'hierarchy':
result = pobj.Hierarchy
break;
case 'location':
result = pobj.location
break;
case 'meatatable':
result = pobj.CollapseMetaTable
break;
case 'timestamp':
result = pobj.TimeStamp
break;
}
break;
case 'Investment':
switch(dPoint) {
case 'style':
result = pobj.Investment.Style
break;
case 'stage':
result = pobj.Investment.Stage
break;
case 'ccy':
result = pobj.Investment.Ccy
break;
case 'type':
result = pobj.Investment.Type
break;
case 'tradingd':
result = pobj.Trading.Date
break;
case 'tradingp':
result = pobj.Trading.Price
break;
}
break;
case 'Place':
switch(dPoint) {
case 'style':
result = pobj.Place.Style
break;
case 'subtype':
result = pobj.Place.SubType
break;
case 'location':
result = pobj.Place.Location
break;
case 'type':
result = pobj.Place.Type
break;
case 'country':
result = pobj.Place.Country
break;
case 'status':
result = pobj.Place.Status
break;
case 'phone':
result = pobj.Phone
break;
case 'email':
result = pobj.Email
break;
case 'website':
result = pobj.Website
break;
}
break;
case 'Source':
switch(dPoint) {
case 'author':
result = pobj.Source.Author
break;
case 'lang':
result = pobj.Source.Language
break;
case 'published':
result = pobj.Source.Published
break;
case 'type':
result = pobj.Source.Type
break;
case 'link':
result = pobj.Source.Link
break;
case 'read':
result = pobj.Source.Read
break;
}
break;
case 'Product':
switch(dPoint) {
case 'value':
result = pobj.Product.Value
break;
case 'type':
result = pobj.Product.Type
break;
case 'link':
result = pobj.Product.Link
break;
}
break;
case 'Server':
switch(dPoint) {
case 'cpu':
result = pobj.Performance.CPU
break;
case 'ram':
result = pobj.Performance.RAM
break;
case 'bw':
result = pobj.Performance.Bandwidth
break;
case 'speed':
result = pobj.Performance.Speed
break;
case 'os':
result = pobj.Characteristics.OS
break;
case 'dom':
result = pobj.Characteristics.Domiciliation
break;
case 'ipv4':
result = pobj.Characteristics.IPv4
break;
case 'hostname':
result = pobj.Characteristics.Hostname
break;
case 'host':
result = pobj.Characteristics.Host
break;
case 'subdomain':
result = pobj.Characteristics.SubDomain
break;
case 'capa':
result = pobj.Disk.Capa
break;
case 'type':
result = pobj.Disk.Type
break;
case 'usedspace':
result = pobj.Disk.UsedSpace
break;
case 'timestamp':
result = pobj.Disk.TimeStamp
break;
}
break;
case 'Task':
switch(dPoint) {
case 'priority':
result = pobj.Task.Priority
break;
case 'status':
result = pobj.Task.Status
break;
case 'startdate':
result = pobj.Task.StartDate
break;
case 'duedate':
result = pobj.Task.DueDate
break;
case 'nextreviewdate':
result = pobj.Task.NextReviewDate
break;
}
break;
case 'Travel':
switch(dPoint) {
case 'country':
result = pobj.Travel.Country
break;
case 'duration':
result = pobj.Travel.Duration
break;
case 'budget':
result = pobj.Travel.Budget
break;
case 'type':
result = pobj.Travel.Type
break;
case 'lbestseason':
result = pobj.Travel.BestSeason
break;
case 'departuredate':
result = pobj.Travel.DepartureDate
break;
}
break;
}
return result
}
}

@ -1,61 +1,18 @@
let {sourcetype, dateadded, language, author, publicationd, theme, readingd} = input;
const {globalFunc} = customJS
const DataType = 'Source'
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(`${sourcetype}`)})
.filter(p => {return !p.file.path.contains('00.01') && p.DocType !== undefined && p.DocType !== null && p.DocType.contains(DataType) && p.Source.Type !== undefined && p.Source.Type !== null && p.Source.Type.contains(`${sourcetype}`)})
function DataCheck(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)
} else if (!Array.isArray(iarg1)) {
var result = 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 result = tempresult
}
return result
}
const iArray = [sourcetype, dateadded, language, author, publicationd, theme, readingd];
const dArray = ["sourcetype", "dateadded", "language", "author", "publicationd", "theme", "readingd"];
function IsInSearch(book) {
if (Boolean(theme)) {
var result_tag = DataCheck(book.Tag, theme)
} else {var result_tag = true}
if (Boolean(dateadded)) {
var result_date = DataCheck(book.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}
}
} else {var result_read = true}
var result = result_tag && result_date && result_lang && result_auth && result_pub && result_read
return result
if (page.length === 0) {
return '"No result matching your query"'
}
if (page.length > 0) {
dv.table(["Title", "Author", "Published date", "Language", "Themes", "Date read"], page
.where(p => p && IsInSearch(p))
dv.table(globalFunc.GetTableHeaders(DataType, 0), page
.where(p => p && globalFunc.IsInSearch(p, DataType, dArray, iArray))
.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"'}
.map(p => globalFunc.GetTableMap(DataType, 0,p)));

@ -1,21 +1,5 @@
let thisf = dv.current();
let {toprint} = input;
const {globalFunc} = customJS
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);
dv.paragraph("search terms: \n" + globalFunc.BuildList(toprint, "\n"));

@ -1,69 +1,18 @@
var debug = "found"
var debugtitle = "string"
let curr = dv.current();
const {globalFunc} = customJS
const DataType = 'Investment'
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')})
.filter(p => {return !p.file.path.contains('00.') && p.DocType !== undefined && p.DocType !== null && p.DocType.contains(DataType)})
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
}
const iArray = [invtype, dateadded, style, stage, ccy, theme, tradingd, tradingp];
const dArray = ["invtype", "dateadded", "style", "stage", "ccy", "theme", "tradingd", "tradingp"];
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) {
return '"No result matching your query"'
}
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))
dv.table(globalFunc.GetTableHeaders(DataType, tabletype), page
.where(p => p && globalFunc.IsInSearch(p, DataType, dArray, iArray))
.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"'}
.map(p => globalFunc.GetTableMap(DataType, tabletype,p)));

@ -1,89 +1,19 @@
var debug = "found"
var debugtitle = "string"
const {globalFunc} = customJS
const DataType = 'Place'
let curr = dv.current();
let {placetype, dateadded, style, ambiance, area, theme, country, status} = input;
let templacetype = globalFunc.Get1stArg(placetype)
let page = dv.pages()
.filter(p => {return !p.file.path.contains('00.') && p.DocType !== undefined && p.DocType !== null && p.DocType.contains('Place')})
.filter(p => {return !p.file.path.contains('00.') && p.DocType !== undefined && p.DocType !== null && p.DocType.contains(DataType)})
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)
const iArray = [placetype, dateadded, style, ambiance, area, theme, country, status];
const dArray = ["placetype", "dateadded", "style", "ambiance", "area", "theme", "country", "status"];
function GetMainPlaceType(arg3) {
if (!Array.isArray(arg3)) {
return arg3
} else {
return arg3[0]
}
if (page.length === 0) {
return '"No result matching your query"'
}
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))
dv.table(globalFunc.GetTableHeaders(DataType, templacetype), page
.where(p => p && globalFunc.IsInSearch(p, DataType, dArray, iArray))
.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"'}
.map(p => globalFunc.GetTableMap(DataType, templacetype,p)));

@ -0,0 +1,17 @@
const {globalFunc} = customJS
const DataType = 'Product'
let {prodtype, dateadded, prodvalue, theme} = input;
let page = dv.pages()
.filter(p => { return !p.file.path.contains('00.0') && p.DocType !== undefined && p.DocType !== null && p.DocType.contains(DataType)})
const iArray = [prodtype, dateadded, prodvalue, theme];
const dArray = ["prodtype", "dateadded", "prodvalue", "theme"];
if (page.length === 0) {
return '"No result matching your query"'
}
dv.table(globalFunc.GetTableHeaders(DataType, 0), page
.where(p => p && globalFunc.IsInSearch(p, DataType, dArray, iArray))
.sort(p => p.file.name, `asc`)
.map(p => globalFunc.GetTableMap(DataType, 0, p)));

@ -1,70 +1,21 @@
var debug = "found"
var debugtitle = "string"
var debugtitle = "found"
const {globalFunc} = customJS
const DataType = 'Investment'
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')})
.filter(p => {return !p.file.path.contains('00.01') && p.DocType !== undefined && p.DocType !== null && p.DocType.contains(DataType)})
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
}
const iArray = [invtype, dateadded, style, stage, ccy, theme, tradingd, tradingp];
const dArray = ["invtype", "dateadded", "style", "stage", "ccy", "theme", "tradingd", "tradingp"];
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) {
return '"No result matching your query"'
}
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))
dv.table(globalFunc.GetTableHeaders(DataType, tabletype), page
.where(p => p && globalFunc.IsInSearch(p, DataType, dArray, iArray))
.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"'}
.map(p => globalFunc.GetTableMap(DataType, tabletype,p)));

@ -102,6 +102,10 @@ dv.view("00.01 Admin/dv-views/query_place", {country: "UK", placetype: "Bar", ar
#### Shoreditch
```dataviewjs
dv.paragraph("header: " + this.getPreviousHeader)
```
```dataviewjs
dv.view("00.01 Admin/dv-views/query_place", {country: "UK", placetype: "Bar", area: "Shoreditch"})
```

@ -1,10 +1,10 @@
---
QPType: Hotel
QPType: ["Hotel", "Restaurant", "Bar"]
QPStyle:
QPAmbiance:
QPKeyword:
QPArea: Marais
QPKeyword: Terrace
QPArea:
QPStatus:
QPDAdded:
Alias: ["Paris"]

@ -410,10 +410,8 @@ _**Total**_ | £106.54 | £66.55
&emsp;
```dataview
Table Product.Link as "Link", Product.Value as "Price Range" from "05.01 Computer setup"
Where DocType = "Product"
Sort file.name ascending
```dataviewjs
dv.view("00.01 Admin/dv-views/query_product", {theme: "Admin"})
```
&emsp;

Loading…
Cancel
Save