Вверх ↑
Ответов: 649
Рейтинг: 138
#1: 2023-08-30 06:30:49 ЛС | профиль | цитата
Пример парсера JSON в таблицу MTStrTbl с помощью SQLite
Add(MainForm,2953706,21,84)
{
Width=649
Point(onClose)
link(onCreate,7361690:doOpen,[])
link(onClose,7361690:doClose,[])
}
Add(DS_SQLite,7361690,70,98)
{
Name="js"
FileName=":memory:"
link(onOpen,16774519:doString,[])
}
Add(DSC_Query,7586605,224,98)
{
SQL="select\r\n json_extract(value, '$.ID') as ID\r\n ,json_extract(value, '$.NumCode') as NumCode\r\n ,json_extract(value, '$.CharCode') as CharCode\r\n ,json_extract(value, '$.Nominal') as Nominal\r\n ,json_extract(value, '$.Name') as Name\r\n ,json_extract(value, '$.Value') as Value\r\n ,json_extract(value, '$.Previous') as Previous\r\nfrom\r\n(select *\r\nfrom cbr, json_each(cbr.data, '$.Valute'))\r\n; "
DSManager="js"
link(onQuery,9610740:doAddRow,[])
link(onColumns,9610740:doAddCols,[])
}
Add(DSC_Exec,2918495,175,98)
{
DSManager="js"
link(onExec,7586605:doQuery,[])
}
Add(FormatStr,16774519,126,98)
{
DataCount=1
Mask="CREATE TABLE cbr (id INTEGER PRIMARY KEY, data JSON);\r\n\r\nINSERT INTO cbr (id, data) VALUES (1, json('%1'));"
link(onFString,2918495:doExec,[])
link(Str1,7461844:Text,[])
}
Add(MTStrTbl,856637,21,35)
{
Width=633
Height=261
Align=5
Name="asd"
}
Add(MST_DB,9610740,280,98)
{
MSTControl="asd"
link(onChange,2466544:doColAction,[])
}
Add(MST_ColAction,2466544,329,98)
{
Action=9
Index=-2
MSTControl="asd"
}
Add(StrList,7461844,126,42)
{
Strings=#1:{|40: "Date": "2023-08-29T11:30:00+03:00",|48: "PreviousDate": "2023-08-26T11:30:00+03:00",|84: "PreviousURL": "\/\/www.cbr-xml-daily.ru\/archive\/2023\/08\/26\/daily_json.js",|45: "Timestamp": "2023-08-29T14:00:00+03:00",|15: "Valute": {|16: "AUD": {|27: "ID": "R01010",|29: "NumCode": "036",|30: "CharCode": "AUD",|25: "Nominal": 1,|43: "Name": "Австралийский доллар",|29: "Value": 61.3979,|31: "Previous": 60.7765|10: },|16: "AZN": {|28: "ID": "R01020A",|29: "NumCode": "944",|30: "CharCode": "AZN",|25: "Nominal": 1,|44: "Name": "Азербайджанский манат",|29: "Value": 56.1598,|31: "Previous": 55.7128|10: },|16: "GBP": {|27: "ID": "R01035",|29: "NumCode": "826",|30: "CharCode": "GBP",|25: "Nominal": 1,|63: "Name": "Фунт стерлингов Соединенного королевства",|30: "Value": 120.7526,|32: "Previous": 119.7914|10: },|16: "AMD": {|27: "ID": "R01060",|29: "NumCode": "051",|30: "CharCode": "AMD",|27: "Nominal": 100,|39: "Name": "Армянских драмов",|29: "Value": 24.7342,|30: "Previous": 24.538|10: },|16: "BYN": {|28: "ID": "R01090B",|29: "NumCode": "933",|30: "CharCode": "BYN",|25: "Nominal": 1,|40: "Name": "Белорусский рубль",|29: "Value": 29.8938,|31: "Previous": 29.8615|10: },|16: "BGN": {|27: "ID": "R01100",|29: "NumCode": "975",|30: "CharCode": "BGN",|25: "Nominal": 1,|37: "Name": "Болгарский лев",|29: "Value": 52.7585,|31: "Previous": 52.4922|10: },|16: "BRL": {|27: "ID": "R01115",|29: "NumCode": "986",|30: "CharCode": "BRL",|25: "Nominal": 1,|39: "Name": "Бразильский реал",|29: "Value": 19.5763,|29: "Previous": 19.43|10: },|16: "HUF": {|27: "ID": "R01135",|29: "NumCode": "348",|30: "CharCode": "HUF",|27: "Nominal": 100,|42: "Name": "Венгерских форинтов",|28: "Value": 26.923,|31: "Previous": 26.6771|10: },|16: "VND": {|27: "ID": "R01150",|29: "NumCode": "704",|30: "CharCode": "VND",|29: "Nominal": 10000,|41: "Name": "Вьетнамских донгов",|29: "Value": 39.8463,|31: "Previous": 39.5588|10: },|16: "HKD": {|27: "ID": "R01200",|29: "NumCode": "344",|30: "CharCode": "HKD",|25: "Nominal": 1,|41: "Name": "Гонконгский доллар",|29: "Value": 12.1915,|31: "Previous": 12.0975|10: },|16: "GEL": {|27: "ID": "R01210",|29: "NumCode": "981",|30: "CharCode": "GEL",|25: "Nominal": 1,|38: "Name": "Грузинский лари",|29: "Value": 36.3024,|31: "Previous": 35.8933|10: },|16: "DKK": {|27: "ID": "R01215",|29: "NumCode": "208",|30: "CharCode": "DKK",|25: "Nominal": 1,|36: "Name": "Датская крона",|29: "Value": 13.8435,|31: "Previous": 13.7736|10: },|16: "AED": {|27: "ID": "R01230",|29: "NumCode": "784",|30: "CharCode": "AED",|25: "Nominal": 1,|33: "Name": "Дирхам ОАЭ",|29: "Value": 25.9928,|31: "Previous": 25.7859|10: },|16: "USD": {|27: "ID": "R01235",|29: "NumCode": "840",|30: "CharCode": "USD",|25: "Nominal": 1,|33: "Name": "Доллар США",|29: "Value": 95.4717,|31: "Previous": 94.7117|10: },|16: "EUR": {|27: "ID": "R01239",|29: "NumCode": "978",|30: "CharCode": "EUR",|25: "Nominal": 1,|27: "Name": "Евро",|30: "Value": 103.2434,|32: "Previous": 102.2586|10: },|16: "EGP": {|27: "ID": "R01240",|29: "NumCode": "818",|30: "CharCode": "EGP",|26: "Nominal": 10,|40: "Name": "Египетских фунтов",|29: "Value": 30.9014,|31: "Previous": 30.6554|10: },|16: "INR": {|27: "ID": "R01270",|29: "NumCode": "356",|30: "CharCode": "INR",|26: "Nominal": 10,|38: "Name": "Индийских рупий",|29: "Value": 11.4868,|31: "Previous": 11.3986|10: },|16: "IDR": {|27: "ID": "R01280",|29: "NumCode": "360",|30: "CharCode": "IDR",|29: "Nominal": 10000,|42: "Name": "Индонезийских рупий",|28: "Value": 62.412,|31: "Previous": 62.0938|10: },|16: "KZT": {|27: "ID": "R01335",|29: "NumCode": "398",|30: "CharCode": "KZT",|27: "Nominal": 100,|42: "Name": "Казахстанских тенге",|29: "Value": 20.7471,|31: "Previous": 20.4986|10: },|16: "CAD": {|27: "ID": "R01350",|29: "NumCode": "124",|30: "CharCode": "CAD",|25: "Nominal": 1,|39: "Name": "Канадский доллар",|29: "Value": 70.1688,|31: "Previous": 69.8206|10: },|16: "QAR": {|27: "ID": "R01355",|29: "NumCode": "634",|30: "CharCode": "QAR",|25: "Nominal": 1,|37: "Name": "Катарский риал",|29: "Value": 26.2285,|31: "Previous": 26.0197|10: },|16: "KGS": {|27: "ID": "R01370",|29: "NumCode": "417",|30: "CharCode": "KGS",|26: "Nominal": 10,|39: "Name": "Киргизских сомов",|29: "Value": 10.8185,|31: "Previous": 10.7359|10: },|16: "CNY": {|27: "ID": "R01375",|29: "NumCode": "156",|30: "CharCode": "CNY",|25: "Nominal": 1,|37: "Name": "Китайский юань",|28: "Value": 13.055,|30: "Previous": 12.972|10: },|16: "MDL": {|27: "ID": "R01500",|29: "NumCode": "498",|30: "CharCode": "MDL",|26: "Nominal": 10,|38: "Name": "Молдавских леев",|29: "Value": 53.5368,|30: "Previous": 53.055|10: },|16: "NZD": {|27: "ID": "R01530",|29: "NumCode": "554",|30: "CharCode": "NZD",|25: "Nominal": 1,|44: "Name": "Новозеландский доллар",|29: "Value": 56.4906,|31: "Previous": 56.0504|10: },|16: "NOK": {|27: "ID": "R01535",|29: "NumCode": "578",|30: "CharCode": "NOK",|26: "Nominal": 10,|38: "Name": "Норвежских крон",|29: "Value": 89.1534,|31: "Previous": 88.8819|10: },|16: "PLN": {|27: "ID": "R01565",|29: "NumCode": "985",|30: "CharCode": "PLN",|25: "Nominal": 1,|38: "Name": "Польский злотый",|29: "Value": 23.0619,|30: "Previous": 22.926|10: },|16: "RON": {|28: "ID": "R01585F",|29: "NumCode": "946",|30: "CharCode": "RON",|25: "Nominal": 1,|36: "Name": "Румынский лей",|29: "Value": 20.9006,|31: "Previous": 20.6939|10: },|16: "XDR": {|27: "ID": "R01589",|29: "NumCode": "960",|30: "CharCode": "XDR",|25: "Nominal": 1,|60: "Name": "СДР (специальные права заимствования)",|30: "Value": 126.6757,|32: "Previous": 125.9552|10: },|16: "SGD": {|27: "ID": "R01625",|29: "NumCode": "702",|30: "CharCode": "SGD",|25: "Nominal": 1,|42: "Name": "Сингапурский доллар",|29: "Value": 70.4172,|31: "Previous": 69.7743|10: },|16: "TJS": {|27: "ID": "R01670",|29: "NumCode": "972",|30: "CharCode": "TJS",|26: "Nominal": 10,|40: "Name": "Таджикских сомони",|29: "Value": 87.0989,|31: "Previous": 86.4079|10: },|16: "THB": {|27: "ID": "R01675",|29: "NumCode": "764",|30: "CharCode": "THB",|26: "Nominal": 10,|40: "Name": "Таиландских батов",|29: "Value": 27.1426,|31: "Previous": 27.0022|10: },|16: "TRY": {|28: "ID": "R01700J",|29: "NumCode": "949",|30: "CharCode": "TRY",|26: "Nominal": 10,|35: "Name": "Турецких лир",|29: "Value": 36.1227,|31: "Previous": 34.9256|10: },|16: "TMT": {|28: "ID": "R01710A",|29: "NumCode": "934",|30: "CharCode": "TMT",|25: "Nominal": 1,|46: "Name": "Новый туркменский манат",|29: "Value": 27.2776,|31: "Previous": 27.0605|10: },|16: "UZS": {|27: "ID": "R01717",|29: "NumCode": "860",|30: "CharCode": "UZS",|29: "Nominal": 10000,|38: "Name": "Узбекских сумов",|29: "Value": 79.0977,|31: "Previous": 78.6053|10: },|16: "UAH": {|27: "ID": "R01720",|29: "NumCode": "980",|30: "CharCode": "UAH",|26: "Nominal": 10,|40: "Name": "Украинских гривен",|29: "Value": 25.8393,|31: "Previous": 25.6518|10: },|16: "CZK": {|27: "ID": "R01760",|29: "NumCode": "203",|30: "CharCode": "CZK",|26: "Nominal": 10,|35: "Name": "Чешских крон",|29: "Value": 42.7683,|31: "Previous": 42.5403|10: },|16: "SEK": {|27: "ID": "R01770",|29: "NumCode": "752",|30: "CharCode": "SEK",|26: "Nominal": 10,|36: "Name": "Шведских крон",|29: "Value": 86.5776,|30: "Previous": 85.911|10: },|16: "CHF": {|27: "ID": "R01775",|29: "NumCode": "756",|30: "CharCode": "CHF",|25: "Nominal": 1,|40: "Name": "Швейцарский франк",|30: "Value": 107.9752,|32: "Previous": 106.9464|10: },|16: "RSD": {|28: "ID": "R01805F",|29: "NumCode": "941",|30: "CharCode": "RSD",|27: "Nominal": 100,|39: "Name": "Сербских динаров",|29: "Value": 88.0414,|31: "Previous": 87.1011|10: },|16: "ZAR": {|27: "ID": "R01810",|29: "NumCode": "710",|30: "CharCode": "ZAR",|26: "Nominal": 10,|45: "Name": "Южноафриканских рэндов",|29: "Value": 51.0609,|31: "Previous": 50.7663|10: },|16: "KRW": {|27: "ID": "R01815",|29: "NumCode": "410",|30: "CharCode": "KRW",|28: "Nominal": 1000,|43: "Name": "Вон Республики Корея",|29: "Value": 72.1412,|31: "Previous": 71.4697|10: },|16: "JPY": {|27: "ID": "R01820",|29: "NumCode": "392",|30: "CharCode": "JPY",|27: "Nominal": 100,|35: "Name": "Японских иен",|29: "Value": 65.1728,|31: "Previous": 64.8266|9: }|5: }|1:}|
}

Пример парсера JSON в кортеж (tree) TreeViewTrain с помощью SQLite
Add(MainForm,2953706,28,84)
{
Width=649
Point(onClose)
link(onCreate,7361690:doOpen,[])
link(onClose,7361690:doClose,[])
}
Add(DS_SQLite,7361690,77,98)
{
Name="js"
FileName=":memory:"
link(onOpen,16774519:doString,[])
}
Add(DSC_Query,7586605,224,98)
{
SQL="select *, key || ' : ' || value\r\nfrom cbr, json_tree(cbr.data, '$')\r\n; "
DSManager="js"
link(onQuery,9833059:doAddNode,[])
}
Add(DSC_Exec,2918495,175,98)
{
DSManager="js"
link(onExec,7586605:doQuery,[])
}
Add(FormatStr,16774519,126,98)
{
DataCount=1
Mask="CREATE TABLE cbr (id INTEGER PRIMARY KEY, data JSON);\r\n\r\nINSERT INTO cbr (id, data) VALUES (1, json('%1'));"
link(onFString,2918495:doExec,[])
link(Str1,7461844:Text,[])
}
Add(StrList,7461844,126,42)
{
Strings=#1:{|40: "Date": "2023-08-29T11:30:00+03:00",|48: "PreviousDate": "2023-08-26T11:30:00+03:00",|84: "PreviousURL": "\/\/www.cbr-xml-daily.ru\/archive\/2023\/08\/26\/daily_json.js",|45: "Timestamp": "2023-08-29T14:00:00+03:00",|15: "Valute": {|16: "AUD": {|27: "ID": "R01010",|29: "NumCode": "036",|30: "CharCode": "AUD",|25: "Nominal": 1,|43: "Name": "Австралийский доллар",|29: "Value": 61.3979,|31: "Previous": 60.7765|10: },|16: "AZN": {|28: "ID": "R01020A",|29: "NumCode": "944",|30: "CharCode": "AZN",|25: "Nominal": 1,|44: "Name": "Азербайджанский манат",|29: "Value": 56.1598,|31: "Previous": 55.7128|10: },|16: "GBP": {|27: "ID": "R01035",|29: "NumCode": "826",|30: "CharCode": "GBP",|25: "Nominal": 1,|63: "Name": "Фунт стерлингов Соединенного королевства",|30: "Value": 120.7526,|32: "Previous": 119.7914|10: },|16: "AMD": {|27: "ID": "R01060",|29: "NumCode": "051",|30: "CharCode": "AMD",|27: "Nominal": 100,|39: "Name": "Армянских драмов",|29: "Value": 24.7342,|30: "Previous": 24.538|10: },|16: "BYN": {|28: "ID": "R01090B",|29: "NumCode": "933",|30: "CharCode": "BYN",|25: "Nominal": 1,|40: "Name": "Белорусский рубль",|29: "Value": 29.8938,|31: "Previous": 29.8615|10: },|16: "BGN": {|27: "ID": "R01100",|29: "NumCode": "975",|30: "CharCode": "BGN",|25: "Nominal": 1,|37: "Name": "Болгарский лев",|29: "Value": 52.7585,|31: "Previous": 52.4922|10: },|16: "BRL": {|27: "ID": "R01115",|29: "NumCode": "986",|30: "CharCode": "BRL",|25: "Nominal": 1,|39: "Name": "Бразильский реал",|29: "Value": 19.5763,|29: "Previous": 19.43|10: },|16: "HUF": {|27: "ID": "R01135",|29: "NumCode": "348",|30: "CharCode": "HUF",|27: "Nominal": 100,|42: "Name": "Венгерских форинтов",|28: "Value": 26.923,|31: "Previous": 26.6771|10: },|16: "VND": {|27: "ID": "R01150",|29: "NumCode": "704",|30: "CharCode": "VND",|29: "Nominal": 10000,|41: "Name": "Вьетнамских донгов",|29: "Value": 39.8463,|31: "Previous": 39.5588|10: },|16: "HKD": {|27: "ID": "R01200",|29: "NumCode": "344",|30: "CharCode": "HKD",|25: "Nominal": 1,|41: "Name": "Гонконгский доллар",|29: "Value": 12.1915,|31: "Previous": 12.0975|10: },|16: "GEL": {|27: "ID": "R01210",|29: "NumCode": "981",|30: "CharCode": "GEL",|25: "Nominal": 1,|38: "Name": "Грузинский лари",|29: "Value": 36.3024,|31: "Previous": 35.8933|10: },|16: "DKK": {|27: "ID": "R01215",|29: "NumCode": "208",|30: "CharCode": "DKK",|25: "Nominal": 1,|36: "Name": "Датская крона",|29: "Value": 13.8435,|31: "Previous": 13.7736|10: },|16: "AED": {|27: "ID": "R01230",|29: "NumCode": "784",|30: "CharCode": "AED",|25: "Nominal": 1,|33: "Name": "Дирхам ОАЭ",|29: "Value": 25.9928,|31: "Previous": 25.7859|10: },|16: "USD": {|27: "ID": "R01235",|29: "NumCode": "840",|30: "CharCode": "USD",|25: "Nominal": 1,|33: "Name": "Доллар США",|29: "Value": 95.4717,|31: "Previous": 94.7117|10: },|16: "EUR": {|27: "ID": "R01239",|29: "NumCode": "978",|30: "CharCode": "EUR",|25: "Nominal": 1,|27: "Name": "Евро",|30: "Value": 103.2434,|32: "Previous": 102.2586|10: },|16: "EGP": {|27: "ID": "R01240",|29: "NumCode": "818",|30: "CharCode": "EGP",|26: "Nominal": 10,|40: "Name": "Египетских фунтов",|29: "Value": 30.9014,|31: "Previous": 30.6554|10: },|16: "INR": {|27: "ID": "R01270",|29: "NumCode": "356",|30: "CharCode": "INR",|26: "Nominal": 10,|38: "Name": "Индийских рупий",|29: "Value": 11.4868,|31: "Previous": 11.3986|10: },|16: "IDR": {|27: "ID": "R01280",|29: "NumCode": "360",|30: "CharCode": "IDR",|29: "Nominal": 10000,|42: "Name": "Индонезийских рупий",|28: "Value": 62.412,|31: "Previous": 62.0938|10: },|16: "KZT": {|27: "ID": "R01335",|29: "NumCode": "398",|30: "CharCode": "KZT",|27: "Nominal": 100,|42: "Name": "Казахстанских тенге",|29: "Value": 20.7471,|31: "Previous": 20.4986|10: },|16: "CAD": {|27: "ID": "R01350",|29: "NumCode": "124",|30: "CharCode": "CAD",|25: "Nominal": 1,|39: "Name": "Канадский доллар",|29: "Value": 70.1688,|31: "Previous": 69.8206|10: },|16: "QAR": {|27: "ID": "R01355",|29: "NumCode": "634",|30: "CharCode": "QAR",|25: "Nominal": 1,|37: "Name": "Катарский риал",|29: "Value": 26.2285,|31: "Previous": 26.0197|10: },|16: "KGS": {|27: "ID": "R01370",|29: "NumCode": "417",|30: "CharCode": "KGS",|26: "Nominal": 10,|39: "Name": "Киргизских сомов",|29: "Value": 10.8185,|31: "Previous": 10.7359|10: },|16: "CNY": {|27: "ID": "R01375",|29: "NumCode": "156",|30: "CharCode": "CNY",|25: "Nominal": 1,|37: "Name": "Китайский юань",|28: "Value": 13.055,|30: "Previous": 12.972|10: },|16: "MDL": {|27: "ID": "R01500",|29: "NumCode": "498",|30: "CharCode": "MDL",|26: "Nominal": 10,|38: "Name": "Молдавских леев",|29: "Value": 53.5368,|30: "Previous": 53.055|10: },|16: "NZD": {|27: "ID": "R01530",|29: "NumCode": "554",|30: "CharCode": "NZD",|25: "Nominal": 1,|44: "Name": "Новозеландский доллар",|29: "Value": 56.4906,|31: "Previous": 56.0504|10: },|16: "NOK": {|27: "ID": "R01535",|29: "NumCode": "578",|30: "CharCode": "NOK",|26: "Nominal": 10,|38: "Name": "Норвежских крон",|29: "Value": 89.1534,|31: "Previous": 88.8819|10: },|16: "PLN": {|27: "ID": "R01565",|29: "NumCode": "985",|30: "CharCode": "PLN",|25: "Nominal": 1,|38: "Name": "Польский злотый",|29: "Value": 23.0619,|30: "Previous": 22.926|10: },|16: "RON": {|28: "ID": "R01585F",|29: "NumCode": "946",|30: "CharCode": "RON",|25: "Nominal": 1,|36: "Name": "Румынский лей",|29: "Value": 20.9006,|31: "Previous": 20.6939|10: },|16: "XDR": {|27: "ID": "R01589",|29: "NumCode": "960",|30: "CharCode": "XDR",|25: "Nominal": 1,|60: "Name": "СДР (специальные права заимствования)",|30: "Value": 126.6757,|32: "Previous": 125.9552|10: },|16: "SGD": {|27: "ID": "R01625",|29: "NumCode": "702",|30: "CharCode": "SGD",|25: "Nominal": 1,|42: "Name": "Сингапурский доллар",|29: "Value": 70.4172,|31: "Previous": 69.7743|10: },|16: "TJS": {|27: "ID": "R01670",|29: "NumCode": "972",|30: "CharCode": "TJS",|26: "Nominal": 10,|40: "Name": "Таджикских сомони",|29: "Value": 87.0989,|31: "Previous": 86.4079|10: },|16: "THB": {|27: "ID": "R01675",|29: "NumCode": "764",|30: "CharCode": "THB",|26: "Nominal": 10,|40: "Name": "Таиландских батов",|29: "Value": 27.1426,|31: "Previous": 27.0022|10: },|16: "TRY": {|28: "ID": "R01700J",|29: "NumCode": "949",|30: "CharCode": "TRY",|26: "Nominal": 10,|35: "Name": "Турецких лир",|29: "Value": 36.1227,|31: "Previous": 34.9256|10: },|16: "TMT": {|28: "ID": "R01710A",|29: "NumCode": "934",|30: "CharCode": "TMT",|25: "Nominal": 1,|46: "Name": "Новый туркменский манат",|29: "Value": 27.2776,|31: "Previous": 27.0605|10: },|16: "UZS": {|27: "ID": "R01717",|29: "NumCode": "860",|30: "CharCode": "UZS",|29: "Nominal": 10000,|38: "Name": "Узбекских сумов",|29: "Value": 79.0977,|31: "Previous": 78.6053|10: },|16: "UAH": {|27: "ID": "R01720",|29: "NumCode": "980",|30: "CharCode": "UAH",|26: "Nominal": 10,|40: "Name": "Украинских гривен",|29: "Value": 25.8393,|31: "Previous": 25.6518|10: },|16: "CZK": {|27: "ID": "R01760",|29: "NumCode": "203",|30: "CharCode": "CZK",|26: "Nominal": 10,|35: "Name": "Чешских крон",|29: "Value": 42.7683,|31: "Previous": 42.5403|10: },|16: "SEK": {|27: "ID": "R01770",|29: "NumCode": "752",|30: "CharCode": "SEK",|26: "Nominal": 10,|36: "Name": "Шведских крон",|29: "Value": 86.5776,|30: "Previous": 85.911|10: },|16: "CHF": {|27: "ID": "R01775",|29: "NumCode": "756",|30: "CharCode": "CHF",|25: "Nominal": 1,|40: "Name": "Швейцарский франк",|30: "Value": 107.9752,|32: "Previous": 106.9464|10: },|16: "RSD": {|28: "ID": "R01805F",|29: "NumCode": "941",|30: "CharCode": "RSD",|27: "Nominal": 100,|39: "Name": "Сербских динаров",|29: "Value": 88.0414,|31: "Previous": 87.1011|10: },|16: "ZAR": {|27: "ID": "R01810",|29: "NumCode": "710",|30: "CharCode": "ZAR",|26: "Nominal": 10,|45: "Name": "Южноафриканских рэндов",|29: "Value": 51.0609,|31: "Previous": 50.7663|10: },|16: "KRW": {|27: "ID": "R01815",|29: "NumCode": "410",|30: "CharCode": "KRW",|28: "Nominal": 1000,|43: "Name": "Вон Республики Корея",|29: "Value": 72.1412,|31: "Previous": 71.4697|10: },|16: "JPY": {|27: "ID": "R01820",|29: "NumCode": "392",|30: "CharCode": "JPY",|27: "Nominal": 100,|35: "Name": "Японских иен",|29: "Value": 65.1728,|31: "Previous": 64.8266|9: }|5: }|1:}|
}
Add(TreeViewTrain,13471299,322,91)
{
Left=140
Top=175
Align=5
Name="dsa"
CaptionIndex=10
ParentIDIndex=7
IDIndex=6
Point(doExpand)
}
Add(TVT_AddNode,9833059,273,98)
{
TreeView="dsa"
link(onAddNode,13471299:doExpand,[])
}

или так
Add(MainForm,2953706,84,133)
{
Width=649
Point(onClose)
link(onCreate,14737172:doData,[])
}
Add(MultiElementEx,2906271,203,147)
{
link(onParse,9833059:doAddNode,[])
link(onFinish,13471299:doExpand,[(256,160)(256,202)])
}
BEGIN_SDK
Add(EditMultiEx,1971279,21,21)
{
WorkCount=#7:doParse|
EventCount=#7:onParse|8:onFinish|7:onError|
DataCount=#4:json|
Width=419
Height=151
VOffset=28
HOffset=42
link(doParse,12447265:doValue,[])
}
Add(DS_SQLite,7361690,126,49)
{
Name="js"
FileName=":memory:"
Point(onError)
link(onOpen,16774519:doString,[])
link(onError,13069585:doWork2,[(165,62)(165,97)])
}
Add(DSC_Exec,2918495,224,49)
{
DSManager="js"
link(onExec,4332115:doEvent1,[])
link(onError,13069585:doWork1,[(263,62)])
}
Add(FormatStr,16774519,175,49)
{
DataCount=1
Mask="CREATE TABLE cbr (id INTEGER PRIMARY KEY, data JSON);\r\nINSERT INTO cbr (id, data) VALUES (1, json('%1'));"
link(onFString,2918495:doExec,[])
link(Str1,12447265:Value,[(181,40)(111,40)(111,89)(69,89)])
}
Add(DSC_Query,6401394,315,49)
{
SQL="select *, key || ' : ' || IIF(atom IS NULL,'', atom)\r\nfrom cbr, json_tree(cbr.data, '$')\r\n; "
DSManager="js"
link(onQuery,1971279:onParse,[])
link(onError,13385223:doWork2,[])
}
Add(Hub,4332115,273,49)
{
OutCount=3
link(onEvent1,6401394:doQuery,[])
link(onEvent2,1971279:onFinish,[(298,62)(298,41)(354,41)(354,62)])
link(onEvent3,7361690:doClose,[(298,69)(298,90)(116,90)(116,62)])
}
Add(Icon,14279430,385,105)
{
@Hint=#5:#main|
Icon=[ZIP9E09000078DAC5954D0A833010854777DD7459EA2F5D76D903782C518FD0B52082F750F756EFA4AB3413899460AA31DA3E792293E44B66120980419FEB15E8FB06CF13C00500EED434040F18E34CB4ED751ECD457EA86118481CC7C4B66D8253AB18C72449C21832215B952B1AE790C9B22CD6A76D5BE5DC9BA699F29089AF61AB96C6CFB55755453CCF2341104C31FCC6585DD7DA7CD775594CE463CCF77D6DBE6C8C4A5F593B5F27D642D45C5E5BF9621DF6E21F5D1F94E338D2FD15EBB6855F96259B43E4637DF0ECEAF28FFEBFFEC1E7F5975997FF8D6D9AE66E7CAE2CCB886118CC799EEFCA2F8A6262A769AAB53F623F15F6E7FDD275DD2A3E67637DD6288A22A5BB50858DEAFB9E846138E5B16415F6518283F5062C6DC95E]
}
Add(HubEx,13069585,259,91)
{
link(onEvent,13385223:doWork3,[(361,97)])
}
Add(Memory,12447265,63,49)
{
Point(Data)
link(onData,7361690:doOpen,[])
link(Data,1971279:json,[])
}
Add(HubEx,13385223,357,63)
{
link(onEvent,1971279:onError,[])
}
END_SDK
Add(TVT_AddNode,9833059,266,147)
{
TreeView="dsa"
}
Add(StrList,7461844,140,91)
{
Strings=#1:{|40: "Date": "2023-08-29T11:30:00+03:00",|48: "PreviousDate": "2023-08-26T11:30:00+03:00",|84: "PreviousURL": "\/\/www.cbr-xml-daily.ru\/archive\/2023\/08\/26\/daily_json.js",|45: "Timestamp": "2023-08-29T14:00:00+03:00",|15: "Valute": {|16: "AUD": {|27: "ID": "R01010",|29: "NumCode": "036",|30: "CharCode": "AUD",|25: "Nominal": 1,|43: "Name": "Австралийский доллар",|29: "Value": 61.3979,|31: "Previous": 60.7765|10: },|16: "AZN": {|28: "ID": "R01020A",|29: "NumCode": "944",|30: "CharCode": "AZN",|25: "Nominal": 1,|44: "Name": "Азербайджанский манат",|29: "Value": 56.1598,|31: "Previous": 55.7128|10: },|16: "GBP": {|27: "ID": "R01035",|29: "NumCode": "826",|30: "CharCode": "GBP",|25: "Nominal": 1,|63: "Name": "Фунт стерлингов Соединенного королевства",|30: "Value": 120.7526,|32: "Previous": 119.7914|10: },|16: "AMD": {|27: "ID": "R01060",|29: "NumCode": "051",|30: "CharCode": "AMD",|27: "Nominal": 100,|39: "Name": "Армянских драмов",|29: "Value": 24.7342,|30: "Previous": 24.538|10: },|16: "BYN": {|28: "ID": "R01090B",|29: "NumCode": "933",|30: "CharCode": "BYN",|25: "Nominal": 1,|40: "Name": "Белорусский рубль",|29: "Value": 29.8938,|31: "Previous": 29.8615|10: },|16: "BGN": {|27: "ID": "R01100",|29: "NumCode": "975",|30: "CharCode": "BGN",|25: "Nominal": 1,|37: "Name": "Болгарский лев",|29: "Value": 52.7585,|31: "Previous": 52.4922|10: },|16: "BRL": {|27: "ID": "R01115",|29: "NumCode": "986",|30: "CharCode": "BRL",|25: "Nominal": 1,|39: "Name": "Бразильский реал",|29: "Value": 19.5763,|29: "Previous": 19.43|10: },|16: "HUF": {|27: "ID": "R01135",|29: "NumCode": "348",|30: "CharCode": "HUF",|27: "Nominal": 100,|42: "Name": "Венгерских форинтов",|28: "Value": 26.923,|31: "Previous": 26.6771|10: },|16: "VND": {|27: "ID": "R01150",|29: "NumCode": "704",|30: "CharCode": "VND",|29: "Nominal": 10000,|41: "Name": "Вьетнамских донгов",|29: "Value": 39.8463,|31: "Previous": 39.5588|10: },|16: "HKD": {|27: "ID": "R01200",|29: "NumCode": "344",|30: "CharCode": "HKD",|25: "Nominal": 1,|41: "Name": "Гонконгский доллар",|29: "Value": 12.1915,|31: "Previous": 12.0975|10: },|16: "GEL": {|27: "ID": "R01210",|29: "NumCode": "981",|30: "CharCode": "GEL",|25: "Nominal": 1,|38: "Name": "Грузинский лари",|29: "Value": 36.3024,|31: "Previous": 35.8933|10: },|16: "DKK": {|27: "ID": "R01215",|29: "NumCode": "208",|30: "CharCode": "DKK",|25: "Nominal": 1,|36: "Name": "Датская крона",|29: "Value": 13.8435,|31: "Previous": 13.7736|10: },|16: "AED": {|27: "ID": "R01230",|29: "NumCode": "784",|30: "CharCode": "AED",|25: "Nominal": 1,|33: "Name": "Дирхам ОАЭ",|29: "Value": 25.9928,|31: "Previous": 25.7859|10: },|16: "USD": {|27: "ID": "R01235",|29: "NumCode": "840",|30: "CharCode": "USD",|25: "Nominal": 1,|33: "Name": "Доллар США",|29: "Value": 95.4717,|31: "Previous": 94.7117|10: },|16: "EUR": {|27: "ID": "R01239",|29: "NumCode": "978",|30: "CharCode": "EUR",|25: "Nominal": 1,|27: "Name": "Евро",|30: "Value": 103.2434,|32: "Previous": 102.2586|10: },|16: "EGP": {|27: "ID": "R01240",|29: "NumCode": "818",|30: "CharCode": "EGP",|26: "Nominal": 10,|40: "Name": "Египетских фунтов",|29: "Value": 30.9014,|31: "Previous": 30.6554|10: },|16: "INR": {|27: "ID": "R01270",|29: "NumCode": "356",|30: "CharCode": "INR",|26: "Nominal": 10,|38: "Name": "Индийских рупий",|29: "Value": 11.4868,|31: "Previous": 11.3986|10: },|16: "IDR": {|27: "ID": "R01280",|29: "NumCode": "360",|30: "CharCode": "IDR",|29: "Nominal": 10000,|42: "Name": "Индонезийских рупий",|28: "Value": 62.412,|31: "Previous": 62.0938|10: },|16: "KZT": {|27: "ID": "R01335",|29: "NumCode": "398",|30: "CharCode": "KZT",|27: "Nominal": 100,|42: "Name": "Казахстанских тенге",|29: "Value": 20.7471,|31: "Previous": 20.4986|10: },|16: "CAD": {|27: "ID": "R01350",|29: "NumCode": "124",|30: "CharCode": "CAD",|25: "Nominal": 1,|39: "Name": "Канадский доллар",|29: "Value": 70.1688,|31: "Previous": 69.8206|10: },|16: "QAR": {|27: "ID": "R01355",|29: "NumCode": "634",|30: "CharCode": "QAR",|25: "Nominal": 1,|37: "Name": "Катарский риал",|29: "Value": 26.2285,|31: "Previous": 26.0197|10: },|16: "KGS": {|27: "ID": "R01370",|29: "NumCode": "417",|30: "CharCode": "KGS",|26: "Nominal": 10,|39: "Name": "Киргизских сомов",|29: "Value": 10.8185,|31: "Previous": 10.7359|10: },|16: "CNY": {|27: "ID": "R01375",|29: "NumCode": "156",|30: "CharCode": "CNY",|25: "Nominal": 1,|37: "Name": "Китайский юань",|28: "Value": 13.055,|30: "Previous": 12.972|10: },|16: "MDL": {|27: "ID": "R01500",|29: "NumCode": "498",|30: "CharCode": "MDL",|26: "Nominal": 10,|38: "Name": "Молдавских леев",|29: "Value": 53.5368,|30: "Previous": 53.055|10: },|16: "NZD": {|27: "ID": "R01530",|29: "NumCode": "554",|30: "CharCode": "NZD",|25: "Nominal": 1,|44: "Name": "Новозеландский доллар",|29: "Value": 56.4906,|31: "Previous": 56.0504|10: },|16: "NOK": {|27: "ID": "R01535",|29: "NumCode": "578",|30: "CharCode": "NOK",|26: "Nominal": 10,|38: "Name": "Норвежских крон",|29: "Value": 89.1534,|31: "Previous": 88.8819|10: },|16: "PLN": {|27: "ID": "R01565",|29: "NumCode": "985",|30: "CharCode": "PLN",|25: "Nominal": 1,|38: "Name": "Польский злотый",|29: "Value": 23.0619,|30: "Previous": 22.926|10: },|16: "RON": {|28: "ID": "R01585F",|29: "NumCode": "946",|30: "CharCode": "RON",|25: "Nominal": 1,|36: "Name": "Румынский лей",|29: "Value": 20.9006,|31: "Previous": 20.6939|10: },|16: "XDR": {|27: "ID": "R01589",|29: "NumCode": "960",|30: "CharCode": "XDR",|25: "Nominal": 1,|60: "Name": "СДР (специальные права заимствования)",|30: "Value": 126.6757,|32: "Previous": 125.9552|10: },|16: "SGD": {|27: "ID": "R01625",|29: "NumCode": "702",|30: "CharCode": "SGD",|25: "Nominal": 1,|42: "Name": "Сингапурский доллар",|29: "Value": 70.4172,|31: "Previous": 69.7743|10: },|16: "TJS": {|27: "ID": "R01670",|29: "NumCode": "972",|30: "CharCode": "TJS",|26: "Nominal": 10,|40: "Name": "Таджикских сомони",|29: "Value": 87.0989,|31: "Previous": 86.4079|10: },|16: "THB": {|27: "ID": "R01675",|29: "NumCode": "764",|30: "CharCode": "THB",|26: "Nominal": 10,|40: "Name": "Таиландских батов",|29: "Value": 27.1426,|31: "Previous": 27.0022|10: },|16: "TRY": {|28: "ID": "R01700J",|29: "NumCode": "949",|30: "CharCode": "TRY",|26: "Nominal": 10,|35: "Name": "Турецких лир",|29: "Value": 36.1227,|31: "Previous": 34.9256|10: },|16: "TMT": {|28: "ID": "R01710A",|29: "NumCode": "934",|30: "CharCode": "TMT",|25: "Nominal": 1,|46: "Name": "Новый туркменский манат",|29: "Value": 27.2776,|31: "Previous": 27.0605|10: },|16: "UZS": {|27: "ID": "R01717",|29: "NumCode": "860",|30: "CharCode": "UZS",|29: "Nominal": 10000,|38: "Name": "Узбекских сумов",|29: "Value": 79.0977,|31: "Previous": 78.6053|10: },|16: "UAH": {|27: "ID": "R01720",|29: "NumCode": "980",|30: "CharCode": "UAH",|26: "Nominal": 10,|40: "Name": "Украинских гривен",|29: "Value": 25.8393,|31: "Previous": 25.6518|10: },|16: "CZK": {|27: "ID": "R01760",|29: "NumCode": "203",|30: "CharCode": "CZK",|26: "Nominal": 10,|35: "Name": "Чешских крон",|29: "Value": 42.7683,|31: "Previous": 42.5403|10: },|16: "SEK": {|27: "ID": "R01770",|29: "NumCode": "752",|30: "CharCode": "SEK",|26: "Nominal": 10,|36: "Name": "Шведских крон",|29: "Value": 86.5776,|30: "Previous": 85.911|10: },|16: "CHF": {|27: "ID": "R01775",|29: "NumCode": "756",|30: "CharCode": "CHF",|25: "Nominal": 1,|40: "Name": "Швейцарский франк",|30: "Value": 107.9752,|32: "Previous": 106.9464|10: },|16: "RSD": {|28: "ID": "R01805F",|29: "NumCode": "941",|30: "CharCode": "RSD",|27: "Nominal": 100,|39: "Name": "Сербских динаров",|29: "Value": 88.0414,|31: "Previous": 87.1011|10: },|16: "ZAR": {|27: "ID": "R01810",|29: "NumCode": "710",|30: "CharCode": "ZAR",|26: "Nominal": 10,|45: "Name": "Южноафриканских рэндов",|29: "Value": 51.0609,|31: "Previous": 50.7663|10: },|16: "KRW": {|27: "ID": "R01815",|29: "NumCode": "410",|30: "CharCode": "KRW",|28: "Nominal": 1000,|43: "Name": "Вон Республики Корея",|29: "Value": 72.1412,|31: "Previous": 71.4697|10: },|16: "JPY": {|27: "ID": "R01820",|29: "NumCode": "392",|30: "CharCode": "JPY",|27: "Nominal": 100,|35: "Name": "Японских иен",|29: "Value": 65.1728,|31: "Previous": 64.8266|9: }|5: }|1:}|
}
Add(TreeViewTrain,13471299,266,189)
{
Left=140
Top=175
Align=5
Name="dsa"
CaptionIndex=10
ParentIDIndex=7
IDIndex=6
Point(doExpand)
}
Add(DoData,14737172,140,147)
{
link(onEventData,2906271:doParse,[])
link(Data,7461844:Text,[])
}

Внимание!!! Для работы примеров необходимо скачать последнюю версию 32-bit DLL (x86) for SQLite version 3.43.0. - https://www.sqlite.org/download.html
или прямая ссылка - https://www.sqlite.org/2023/sqlite-dll-win32-x86-3430000.zip

Всё в комплекте – https://disk.yandex.ru/d/oF4bm5lKoskiLw

Проверено на
- Windows 10 (x64)
- Hiasm v4.05 build 186 (delphi)
- SQLite version 3.43.0
карма: 14

0
Редактировалось 1 раз(а), последний 2023-11-05 05:26:11