Topic : S01
How to sum up a number, null, or a list of non-groupBy(or groupBy) data with skipping the null value? PS.To sum up one or two fields
Summary
0.field cash =>type: a number, null or a list
0.field card =>type: a number, null or a list
1.DQL10 : How to sum up one or two fields such as cash and card(type: a number, null, or a list) without using groupBy?
2.DQL20 : How to sum up one field such as cash with using groupBy step by step?
3.DQL30 : How to sum up one or two fields such as cash and card(type: a number, null, or a list) with using groupBy?
4.DVJS10: How to TABLE the last_row_Total with sum(cash) and sum(card)?
5.DQL40 : How to TABLE last_row_Total merged with using groupBy and SORT file.name ASC
?
6.DQL50 : How to TABLE last_row_Total merged with using groupBy and SORT file.name ASC
? (To fix Total:111739.79999999999)
7.DQL60 : How to TABLE last_row_Total merged with using groupBy and SORT file.name DESC
?
1. Test
Summary
- by dataview_v0.5.41
2. Overview
Summary
2.1. Main DQL or DVJS
- The fowllowng table presents the main DQLs in the Solutions.
Code Name | Data type | Group By | Purposes | Remark |
---|---|---|---|---|
DQL10_sum_not_null | a number, null, or a list | no | 1.To sum up one or two fields such as cash and card | It is finished. |
DQL20_debug_sum_cash_groupBy | a number, null, or a list | yes | 1.To sum up one field such as cash 2.step by step |
|
DQL30_sum_GROUP_BY_G_month | a number, null, or a list | yes | 1.To sum up one or two fields such as cash and card | It is finished. |
DVJS10_sum_not_null_last_row | 1.a number ,null, a list | no | 1.get i_Total_cash 2.get i_Total_card 3.get i_Total 4.To display them as a table |
|
DQL40_sum_not_null_last_row_ASC | a number, null, or a list | no | 1.To sum up one or two fields such as cash and card 2.To add Total in the last row 3.The unique zzz_2018_Year_Total file in the source folder includes the same DVIF fields, where the inline DVJS is.4.Require SORT file.name ASC |
1.The code is copied from DQL10_sum_not_null .2.To add Total in the last row 3.SORT file.name ASC: To use zzz_2018_Year_Total 4.SORT file.name DESC:To use _____2018_Year_Total 5.The last row Total: 111739.79999999999 is to be fixed in the next version |
DQL50_sum_not_null_last_row_ASC | a number, null, or a list | no | 1.To sum up one or two fields such as cash and card 2.To add Total in the last row 3.The unique zzz_2018_Year_Total file in the source folder includes the same DVIF fields, where the inline DVJS is.4.Require SORT file.name ASC 5.To fix Total:111739.79999999999 which is from the expression 44703.1 + 67036.7 |
1.The code is copied from DQL40_sum_not_null_last_row_ASC .2.To add Total in the last row 3.SORT file.name ASC: To use zzz_2018_Year_Total 4.SORT file.name DESC:To use _____2018_Year_Total 5.To fix Total:111739.79999999999 |
DQL60_sum_not_null_last_row_DESC | a number, null, or a list | no | 1.To sum up one or two fields such as cash and card 2.To add Total in the last row 3.The unique ____2018_Year_Total file in the source folder includes the same DVIF fields, where the inline DVJS is.4.Require SORT file.name DESC 5.To fix Total:111739.79999999999 which is from the expression 44703.1 + 67036.7 |
1.The code is copied from DQL50_sum_not_null_last_row_ASC .2.To add Total in the last row 3.SORT file.name ASC: To use zzz_2018_Year_Total 4.SORT file.name DESC:To use _____2018_Year_Total 5.To fix Total:111739.79999999999 |
Summary_Examples
2.2. Examples
2.2.1. javascript
```javascript
let nResult = null + 10; //=>10
```
2.2.2. Inline DQL
ng_Result=`=null + 10` //=>No implementation found for 'null + number'
nResult= `=default(null, 0) + 10` //=>10
2.2.3. Summary
- Use
default
function to transformnull
into zero within dataview code block
3. Input
Summary
3.1.1. Requirements
- Suppose that there are many files located at the path
100_Project/02_dataview/Q01_Sum/Q01_test_data
. - Suppose that the filenames including
dic_
are to be taken into consideration. - To sum up a number, null, or a list of non-groupBy data with skipping the null value
> The `dic_20220702`, `dic_20220707`, `dic_20220802` and `dic_20220907` must be presented in the current note.
- To sum up a number, null, or a list of groupBy data with skipping the null value
> The `dic_20220802` and `dic_20220907` must be presented in the current note.
3.2. report files
3.2.1. 00_report
- filename :
zzz_2018_Year_Total
> - The report file is ONLY used as the last row of a table by DQL40_sum_not_null_last_row_ASC and DQL50_sum_not_null_last_row_ASC.
> - The file is unique in an Obsidian vault.
---
cash: 44703.1
card: 67036.7
---
### zzz_2018_Year_Total
- The report file is ONLY used as the last row of a table by DQL40_sum_not_null_last_row_ASC and DQL50_sum_not_null_last_row_ASC.
- The file is unique in an Obsidian vault.
- filename :
____2018_Year_Total
> - The report file is ONLY used as the last row of a table by DQL40_sum_not_null_last_row_ASC.
> - The file is unique in an Obsidian vault.
---
cash: 44703.1
card: 67036.7
---
### ____2018_Year_Total
- The report file is ONLY used as the last row of a table by DQL60_sum_not_null_last_row_DESC.
- The file is unique in an Obsidian vault.
3.3. dictionary files
- The filenames in the
Q01_test_data
folder match the/^dic_20220[2-7]0[27]$/
or/^(dic_20220802)|(dic_20220907)$/
Regular Expression. - The
file.mtime
of each file is equal tofile.ctime
+dur(2 days)
. - For example, the
file.ctime
of thedic_20220302
is2022-03-02T19:30:50
. Thefile.mtime
of thedic_20220302
is2022-03-03T19:30:50
. - The files are used primarily in testing and debugging with the
sum
function.
3.3.1. folder: 02_list
- filename :
dic_20220202_YAML
---
cash: [10, 12]
card: [15, 17]
---
- filename :
dic_20220207_DVIF
cash:: 20, 22
card:: 25, 27
3.3.2. folder: 03_null_or_undefined
- filename :
dic_20220302
cash::
card::
- filename :
dic_20220307
cash::
> dic_20220307
> cash => null(dataview_v0.5.36);| cash => undefined(dataview_v0.4.26)
> card => undefined(dataview_v0.5.36)
3.3.3. folder: 04_number
- filename :
dic_20220402
cash:: 202
card:: 302
- filename :
dic_20220407
cash:: 207
card:: 307
3.3.4. folder: 05_number
- filename :
dic_20220502
cash:: 2002
card:: 3002
- filename :
dic_20220507
cash:: 2007
card:: 3007
3.3.5. folder: 06_number_or_list
- filename :
dic_20220602
cash:: 10001, 10001
card:: 30002
- filename :
dic_20220607
cash:: 20007
card:: 12000, 18007
3.3.6. folder: 07_list_or_null
- filename :
dic_20220702
cash:: 101, 101
card::
- filename :
dic_20220707
cash::
card:: 120, 187
3.3.7. folder: 08_number_or_null
- filename :
dic_20220802
cash:: 10.1
card::
3.3.8. folder: 09_null_or_number
- filename :
dic_20220907
cash::
card:: 18.7
4. DQL10_sum_not_null:Final
Summary
4.1. Main DQL
Code Name | Data type | Group By | Purposes | Remark |
---|---|---|---|---|
DQL10_sum_not_null | a number, null, or a list | no | 1.To sum up one or two fields such as cash and card | It is finished. |
4.2. Notes
Purpose:To sum up a number, null, or a list of non-groupBy data with skipping the null value
```ad-info
dic_20220702
cash:: 101, 101
card::
```
```ad-info
dic_20220707
cash::
card:: 120, 187
```
```ad-info
dic_20220802
cash:: 10.1
card::
```
```ad-info
dic_20220907
cash::
card:: 18.7
```
```ad-success
1.The `dic_20220702`, `dic_20220707`, `dic_20220802` and `dic_20220907` are presented in the current note.
Longer Codes:
- Left : `sum(cash)` ==>`choice(cash != null, sum(cash), 0)`
- Right: `sum(card)` ==>`choice(card != null, sum(card), 0)`
```
```ad-success
1.The `dic_20220702`, `dic_20220707`,`dic_20220802` and `dic_20220907` are presented in the current note.
Shorter Codes:
- Left : `sum(cash)` ==>`sum(default(cash, 0))`
- Right: `sum(card)` ==>`sum(default(card, 0))`
```
```ad-bug
1.The `dic_20220702`, `dic_20220707`, `dic_20220802` and `dic_20220907` are not presented in the current note where one DVIF field is null for us in order to sum up two fields such as cash and card by using `sum(cash) + sum(card)`.
2.The reason is that no implementation is found for 'null + number'.
alias: Left + Right AS "Total",
- `sum(cash) + sum(card)` AS "Total"
```
4.3. Code DQL10_sum_not_null
Summary_code
title: DQL10_sum_not_null => 1.To sum up one or two fields such as cash and card(type: a number, null, or a list) 2.non-groupBy data
collapse: open
icon:
color:
```dataview
TABLE WITHOUT ID
file.link AS "File",
typeof(cash) AS "T_Cash",
cash AS "Cash",
card AS "Card",
sum(default(cash, 0)) as "sum_cash",
sum(default(card, 0)) as "sum_card",
sum(default(cash, 0)) + sum(default(card, 0)) AS "Total"
FROM "100_Project/02_dataview/Q01_Sum/Q01_test_data"
WHERE contains(file.name, "dic_")
WHERE file.name != "zzz_2018_Year_Total"
WHERE file.name != "____2018_Year_Total"
WHERE file.name != this.file.name
WHERE cash != null OR card != null
SORT file.name ASC
```
4.3.1. Screenshots(DQL10)
5. DQL20_debug_sum_cash_groupBy
Summary
5.1. Main DQLs
Code Name | Data type | Group By | Purposes | Remark |
---|---|---|---|---|
DQL20_debug_sum_cash_groupBy | a number, null, or a list | yes | 1.To sum up one field such as cash 2.step by step |
5.2. Examples
a_Result11=`=map([10, 20, 30], (e) => e + 6)` //=>16, 26, 36
a_Result11=`=map(list(list(1, 2, 3)), (e) => sum(e))` //=>6
a_Result01=`=filter([10,20,30], (e) => e >= 16)`
//=>20, 30
5.3. Notes
Purpose:To sum up a number, null, or a list of groupBy data with skipping the null value
```ad-info
dic_20220702
cash:: 101, 101
card::
```
```ad-info
dic_20220707
cash::
card:: 120, 187
```
```ad-success
1.dic_20220702 and dic_20220707 are presented in the current note where one field is null and the other is a list.
-
`
sum(
map(rows.cash, (e) =>
sum(default(e, 0))
)
)
` AS "sum_cash"
```
```ad-bug
1.dic_20220702 and dic_20220707 are not presented in the current note where one field is null and the other is a list.
2.The reason is that no implementation is found for 'null + number'.
- `sum(map(rows.cash, (e) => sum(e)))` AS "sum_cash",
```
5.4. Code DQL20_debug_sum_cash_groupBy
Summary_code
title: DQL20_debug_sum_cash_groupBy =>1.To sum up one field such as cash(type: a number, null, or a list) 2.groupBy data 3.step by step
collapse: open
icon:
color:
```dataview
TABLE WITHOUT ID
G_m AS "G_m",
typeof(rows.cash) AS "T_r_cash",
map(rows.cash, (e) => sum(default(e, 0))) AS "S1_map_r_cash",
sum(map(rows.cash, (e) => sum(default(e, 0)))) AS "S2_sum_r_cash",
rows.cash AS "Cash_item"
FROM "100_Project/02_dataview/Q01_Sum/Q01_test_data"
WHERE contains(file.name, "dic_")
WHERE file.name != "zzz_2018_Year_Total"
WHERE file.name != "____2018_Year_Total"
WHERE file.name != this.file.name
SORT file.name ASC
GROUP BY file.day.month AS G_m
```
5.4.1. Screenshots(DQL20)
6. DQL30_sum_GROUP_BY_G_month :Final
Summary
6.1. Main DQL
Code Name | Data type | Group By | Purposes | Remark |
---|---|---|---|---|
DQL30_sum_GROUP_BY_G_month | a number, null, or a list | yes | 1.To sum up one or two fields such as cash and card | It is finished. |
6.2. Notes: Longer codes as a reference
Purpose:To sum up a number, null, or a list of groupBy data with skipping the null value
```ad-info
dic_20220802
cash:: 10.1
card::
```
```ad-info
dic_20220907
cash::
card:: 18.7
```
```ad-success
1.dic_20220802 and dic_20220907 are presented in the current note where one field is null and the other is a number.
Longer Codes:
- Left : `Left` ==>`default(Left, 0)`
- Right: `Right` ==>`default(Right, 0)`
```
```ad-bug
1.dic_20220802 and dic_20220907 are not presented in the current note where one field is null and the other is a number.
2.The reason is that no implementation is found for 'null + number'.
Longer Codes:
alias: Left + Right AS "Total",
sum(map(filter(rows.cash, (e) => e != null), (m) => sum(m))) + sum(map(filter(rows.card, (e) => e != null), (m) => sum(m))) AS "Total",
```
6.3. Code DQL30_sum_GROUP_BY_G_month
Summary_code
title: DQL30_sum_GROUP_BY_G_month =>1.To sum up one or two fields such as cash and card(type: a number, null, or a list) 2.groupBy data
collapse: open
icon:
color:
```dataview
TABLE WITHOUT ID
G_month AS "G_month",
sum(map(rows.cash, (e) => sum(default(e, 0)))) AS "sum_cash",
sum(map(rows.card, (e) => sum(default(e, 0)))) AS "sum_card",
sum(map(rows.cash, (e) => sum(default(e, 0)))) +
sum(map(rows.card, (e) => sum(default(e, 0)))) AS "Total",
rows.cash AS "Cash_item",
rows.card AS "Card_item"
FROM "100_Project/02_dataview/Q01_Sum/Q01_test_data"
WHERE contains(file.name, "dic_")
WHERE file.name != "zzz_2018_Year_Total"
WHERE file.name != "____2018_Year_Total"
WHERE file.name != this.file.name
WHERE cash != null OR card != null
SORT file.name ASC
GROUP BY file.day.month AS G_month
```
6.3.1. Screenshots(DQL30)
7. DVJS10_sum_not_null_last_row
Summary
7.1. Main DVJS
Code Name | Data type | Group By | Purposes | Remark |
---|---|---|---|---|
DVJS10_sum_not_null_last_row | 1.a number ,null, a list | no | 1.get i_Total_cash 2.get i_Total_card 3.get i_Total 4.To display them as a table |
7.2. Code DVJS10_sum_not_null_last_row
Summary_code
title: DVJS10_sum_not_null_last_row =>1.get i_Total_cash 2.get i_Total_card 3.get i_Total 4.To display them as a table
collapse: close
icon:
color:
```dataviewjs
// M11. define pages: gather all relevant pages
// #####################################################################
let pages = dv
.pages('"100_Project/02_dataview/Q01_Sum/Q01_test_data"')
.where((page) => dv.func.contains(page.file.name, "dic_"))
.where((page) => page.file.name !== "zzz_2018_Year_Total")
.where((page) => page.file.name !== "____2018_Year_Total")
.where((page) => page.cash !== null || page.card !== null);
// M21. get i_Total_cash: dv.func.sum(dv.func.default(pages.cash, 0))
// #####################################################################
let i_Total_cash = dv.func.default(dv.func.sum(pages.cash), 0);
// M23. get i_Total_card: dv.func.sum(dv.func.default(pages.card, 0))
// #####################################################################
let i_Total_card = dv.func.default(dv.func.sum(pages.card), 0);
// M25. get i_Total: i_Total_cash + i_Total_card
// #####################################################################
let i_Total = i_Total_cash + i_Total_card;
i_Total = dv.func.round(i_Total, 1);
// M81. Output :i_Total_cash, i_Total_card, i_Total
// #####################################################################
// dv.span("i_Total_cash=" + i_Total_cash);//=>44703.1
// dv.span("<br>");
// dv.span("i_Total_card=" + i_Total_card);//=>67036.7
// dv.span("<br>");
// dv.span("i_Total=" + i_Total);//=>111739.8
// M91. TABLE :i_Total_cash, i_Total_card, i_Total
// #####################################################################
// dv.table(
// ["Name", "Price", "Caffeine Content"],
// [
// ["Black Coffee", 120, 300],
// ["Green Tea", 100, 200],
// ["Apple Juice", 110, 0],
// ["Iced Chocolate", 130, 0],
// ["Hot Chocolate", 105, 6],
// ]
// );
dv.table(
["", "cash", "card", "Total"],
[
["**Total**", i_Total_cash, i_Total_card, i_Total],
]
);
```
7.2.1. Screenshots(DVJS10)
8. DQL40_sum_not_null_last_row_ASC
Summary
8.1. Main DQL
Code Name | Data type | Group By | Purposes | Remark |
---|---|---|---|---|
DQL40_sum_not_null_last_row_ASC | a number, null, or a list | no | 1.To sum up one or two fields such as cash and card 2.To add Total in the last row 3.The unique zzz_2018_Year_Total file in the source folder includes the same DVIF fields, where the inline DVJS is.4.Require SORT file.name ASC |
1.The code is copied from DQL10_sum_not_null .2.To add Total in the last row 3.SORT file.name ASC: To use zzz_2018_Year_Total 4.SORT file.name DESC:To use _____2018_Year_Total 5.The last row Total: 111739.79999999999 is to be fixed in the next version |
8.2. Metadata: used by DQL40_sum_not_null_last_row_ASC
Summary
8.2.1. 00_report
- filename :
zzz_2018_Year_Total
---
cash: 44703.1
card: 67036.7
---
### zzz_2018_Year_Total
- The report file is ONLY used as the last row of a table by DQL40_sum_not_null_last_row_ASC.
- The file is unique in an Obsidian vault.
The DVIF content in the
zzz_2018_Year_Total
file will be replaced with inline DVJS.
8.3. Code DQL40_sum_not_null_last_row_ASC
Summary_code
title: DQL40_sum_not_null_last_row_ASC => 1.To sum up one or two fields such as cash and card(type: a number, null, or a list) 2.non-groupBy data 3.To add Total in the last row 4.The unique `zzz_2018_Year_Total` file in the source folder includes the same DVIF fields, where the inline DVJS is. 5.Require `SORT file.name ASC`
collapse: open
icon:
color:
```dataview
TABLE WITHOUT ID
choice(file.name = "zzz_2018_Year_Total", "**Total**", file.link) AS "File",
cash AS "Cash",
card AS "Card",
sum(default(cash, 0)) as "sum_cash",
sum(default(card, 0)) as "sum_card",
sum(default(cash, 0)) + sum(default(card, 0)) AS "Total"
FROM "100_Project/02_dataview/Q01_Sum/Q01_test_data"
WHERE (contains(file.name, "dic_") OR file.name = "zzz_2018_Year_Total")
WHERE file.name != "____2018_Year_Total"
WHERE file.name != this.file.name
WHERE cash != null OR card != null
SORT file.name ASC
```
8.3.1. Screenshots(DQL40)
9. DQL50_sum_not_null_last_row_ASC
Summary
9.1. Main DQL
Code Name | Data type | Group By | Purposes | Remark |
---|---|---|---|---|
DQL50_sum_not_null_last_row_ASC | a number, null, or a list | no | 1.To sum up one or two fields such as cash and card 2.To add Total in the last row 3.The unique zzz_2018_Year_Total file in the source folder includes the same DVIF fields, where the inline DVJS is.4.Require SORT file.name ASC 5.To fix Total:111739.79999999999 which is from the expression 44703.1 + 67036.7 |
1.The code is copied from DQL40_sum_not_null_last_row_ASC .2.To add Total in the last row 3.SORT file.name ASC: To use zzz_2018_Year_Total 4.SORT file.name DESC:To use _____2018_Year_Total 5.To fix Total:111739.79999999999 |
9.2. Metadata: used by DQL50_sum_not_null_last_row_ASC
Summary
9.2.1. 00_report
- filename :
zzz_2018_Year_Total
---
cash: 44703.1
card: 67036.7
---
### zzz_2018_Year_Total
- The report file is ONLY used as the last row of a table by DQL50_sum_not_null_last_row_ASC.
- The file is unique in an Obsidian vault.
The DVIF content in the
zzz_2018_Year_Total
file will be replaced with inline DVJS.
9.2.2. Notes: a serious bug
```
choice(file.name = "zzz_2018_Year_Total", round([[zzz_2018_Year_Total]].cash +[[zzz_2018_Year_Total]].card, 1) , sum(default(cash, 0)) + sum(default(card, 0))) AS "Total"
```
9.3. Code DQL50_sum_not_null_last_row_ASC
Summary_code
title: DQL50_sum_not_null_last_row_ASC => 1.To sum up one or two fields such as cash and card(type: a number, null, or a list) 2.non-groupBy data 3.To add Total in the last row 4.The unique `zzz_2018_Year_Total` file in the source folder includes the same DVIF fields, where the inline DVJS is. 5.Require `SORT file.name ASC` 6.To fix Total:111739.79999999999 which is from the expression `44703.1 + 67036.7`
collapse: open
icon:
color:
```dataview
TABLE WITHOUT ID
choice(file.name = "zzz_2018_Year_Total", "**Total**", file.link) AS "File",
cash AS "Cash",
card AS "Card",
sum(default(cash, 0)) as "sum_cash",
sum(default(card, 0)) as "sum_card",
round(sum(default(cash, 0)) + sum(default(card, 0)), 1) AS "Total"
FROM "100_Project/02_dataview/Q01_Sum/Q01_test_data"
WHERE (contains(file.name, "dic_") OR file.name = "zzz_2018_Year_Total")
WHERE file.name != "____2018_Year_Total"
WHERE file.name != this.file.name
WHERE cash != null OR card != null
SORT file.name ASC
```
9.3.1. Screenshots(DQL50)
10. DQL60_sum_not_null_last_row_DESC
Summary
10.1. Main DQL
Code Name | Data type | Group By | Purposes | Remark |
---|---|---|---|---|
DQL60_sum_not_null_last_row_DESC | a number, null, or a list | no | 1.To sum up one or two fields such as cash and card 2.To add Total in the last row 3.The unique ____2018_Year_Total file in the source folder includes the same DVIF fields, where the inline DVJS is.4.Require SORT file.name DESC 5.To fix Total:111739.79999999999 which is from the expression 44703.1 + 67036.7 |
1.The code is copied from DQL50_sum_not_null_last_row_ASC .2.To add Total in the last row 3.SORT file.name ASC: To use zzz_2018_Year_Total 4.SORT file.name DESC:To use _____2018_Year_Total 5.To fix Total:111739.79999999999 |
10.2. Metadata: used by DQL60_sum_not_null_last_row_DESC
Summary
10.2.1. 00_report
- filename :
zzz_2018_Year_Total
---
cash: 44703.1
card: 67036.7
---
### zzz_2018_Year_Total
- The report file is ONLY used as the last row of a table by DQL60_sum_not_null_last_row_DESC.
- The file is unique in an Obsidian vault.
The DVIF content in the
zzz_2018_Year_Total
file will be replaced with inline DVJS.
10.2.2. Notes: a serious bug
```
choice(file.name = "____2018_Year_Total", round([[____2018_Year_Total]].cash +[[____2018_Year_Total]].card, 1) , sum(default(cash, 0)) + sum(default(card, 0))) AS "Total"
```
10.3. Code DQL60_sum_not_null_last_row_DESC
Summary_code
title: DQL60_sum_not_null_last_row_DESC => 1.To sum up one or two fields such as cash and card(type: a number, null, or a list) 2.non-groupBy data 3.To add Total in the last row 4.The unique `____2018_Year_Total` file in the source folder includes the same DVIF fields, where the inline DVJS is. 5.Require `SORT file.name DESC` 6.To fix Total:111739.79999999999 which is from the expression `44703.1 + 67036.7`
collapse: open
icon:
color:
```dataview
TABLE WITHOUT ID
choice(file.name = "____2018_Year_Total", "**Total**", file.link) AS "File",
cash AS "Cash",
card AS "Card",
sum(default(cash, 0)) as "sum_cash",
sum(default(card, 0)) as "sum_card",
round(sum(default(cash, 0)) + sum(default(card, 0)), 1) AS "Total"
FROM "100_Project/02_dataview/Q01_Sum/Q01_test_data"
WHERE (contains(file.name, "dic_") OR file.name = "____2018_Year_Total")
WHERE file.name != "zzz_2018_Year_Total"
WHERE file.name != this.file.name
WHERE cash != null OR card != null
SORT file.name DESC
```
10.3.1. Screenshots(DQL60)
11. Conclusion
Summary
- According to the code above, there is a summary as follows.
Field Name | Data type | Group By | Purpose | DQL Expression | DVJS Expression |
---|---|---|---|---|---|
cash | a number, null, or a list of numbers | no | To sum up one field such as cash | sum(default(cash, 0)) AS “sum_cash” |
let i_Total_cash = dv.func.default(dv.func.sum(pages.cash), 0); |
cash | a number, null, or a list of numbers | yes | To sum up one field such as cash | sum(map(rows.cash, (e) => sum(default(e, 0)))) AS “sum_cash” |