Summary_View
```javascript
// #####################################################################
// v1: Q30_DQL10a_JS.js (Mainly use dv.query)
// The view file consists of the PART01 and PART02.
//
// PART01:
// The view, also known as the subroutine, is called by the mDVJS01.
// The steps starting with "V", such as "V11", are from the "View" file v1.
// # Purpose :
// 1.get the page [[Q30_ParentFolder_Config_a]] from the argument, defined in the main program
// 2.define one customizable variable in the Q30_DQL10a_JS
// with the SourcePath_from_CFG
//
// PART02:
// The value of the s_DQL_multiline_with_newlines in the step "V51"
// is from the original "Main" program Q30_DQL10a.
// # Purpose :
// 1.replace one customizable variable in the Q30_DQL10a with one local variable in the v1
//
// One customizable variable in different expressions:
// FROM "${SourcePath_from_CFG}"
// FLATTEN "${SourcePath_from_CFG}" AS C0_Parent
//
// 2.run the s_DQL_multiline_with_newlines via dv.query
//
// Note:
// 1.m1 = mDVJS01 = mDVJS01_reuse_Q30_DQL10a_JS_and_maintain_One_customizable_variable
// 2.v1 = Q30_DQL10a_JS.js
// 3.c1 = Q30_ParentFolder_Config_a.md
// 4.Q30_DQL10 = Q30_DQL10a = m1 + v1 + c1
// #####################################################################
// #####################################################################
// ### ###
// ### PART01: the beginning ###
// ### ###
// #####################################################################
// V10.JavaScript Object Destructuring Assignment
// RIGHT expression:
// input.Config_a: get the page [[Q30_ParentFolder_Config_a]]
//
// LEFT expression:
// 1.get three fields from the page [[Q30_ParentFolder_Config_a]]
// via the argument, defined in the main program
// original fields: SourcePath, medium_category_of, and today
// 2.assign them as three local variables in the Q78_DQL10a_JS.js
// local variables:Use_Case_from_CFG, filename_of_unique_page_in_Parent_from_CFG, and C0_Parent_from_CFG
//
// #####################################################################
let {
Use_Case: Use_Case_from_CFG,
filename_of_unique_page_in_Parent: filename_of_unique_page_in_Parent_from_CFG,
C0_Parent: C0_Parent_from_CFG
} = input.Config_a;
// V11. define Q30_ParentFolder_Config_current: the current page
// #####################################################################
// USE_CASE_11_read_one_file: Use one mDVJS01 in any location to query
// any path by reading one file, which exists
// in a C0_Parent folder.
// let Q30_ParentFolder_Config_current = dv.page("20230328_Q30_001_C0");
//
// USE_CASE_12_read_one_YAML: Use one mDVJS01 in any location to query
// any path by reading one YAML, which is the path
// for a C0_Parent folder.
// let Q30_ParentFolder_Config_current = dv.current();
//
// USE_CASE_13_many_copies: Many mDVJS01 copies exist in different index files
// , which exists in different C0_Parent folders.
let Q30_ParentFolder_Config_current = input.Config_current;
// V21. define SourcePath_from_CFG:
// #####################################################################
// USE_CASE_11_read_one_file:
// inDQL: `=[[Q30_index_C0]].file.folder`
// inDVJS: `$=dv.page("Q30_index_C0").file.folder`
// DVJS : dv.span(dv.page("Q30_index_C0").file.folder);
//=>"100_Project/02_dataview/Q30_ParentFolder/Q30_test_data/C0_Parent"
// let SourcePath_from_CFG = dv.page(
// Q30_ParentFolder_Config_a.filename_of_unique_page_in_Parent
// ).file.folder;
//
// USE_CASE_12_read_one_YAML:
// C0_Parent = "100_Project/02_dataview/Q30_ParentFolder/Q30_test_data/C0_Parent";
// let SourcePath_from_CFG = Q30_ParentFolder_Config_a.C0_Parent;
//
// USE_CASE_13_many_copies :
// =>"100_Project/02_dataview/Q30_ParentFolder/Q30_test_data/C0_Parent"
// let SourcePath_from_CFG = Q30_ParentFolder_Config_current.file.folder;
let SourcePath_from_CFG = "";
switch (Use_Case_from_CFG) {
case "USE_CASE_11_read_one_file":
SourcePath_from_CFG = dv.page(
filename_of_unique_page_in_Parent_from_CFG
).file.folder;
break;
case "USE_CASE_12_read_one_YAML":
SourcePath_from_CFG = C0_Parent_from_CFG;
break;
case "USE_CASE_13_many_copies":
SourcePath_from_CFG = Q30_ParentFolder_Config_current.file.folder;
break;
default:
// do nothing
}
// #####################################################################
// ### ###
// ### PART02: the beginning ###
// ### ###
// #####################################################################
// #####################################################################
// V51. define s_DQL_multiline_with_newlines: a multiline string with newlines
// the Q30_DQL10a with one customizable variable
//
// One customizable variable in different expressions:
// FROM "${SourcePath_from_CFG}"
// FLATTEN "${SourcePath_from_CFG}" AS C0_Parent
// #####################################################################
let s_DQL_multiline_with_newlines =`
LIST WITHOUT ID
P_SomeIndentation +
P_SubFolderName +
map(rows.file.link, (e) => "<br>" + P_SomeIndentation + "⦁ " + e)
FROM "${SourcePath_from_CFG}"
FLATTEN "${SourcePath_from_CFG}" AS C0_Parent
WHERE startswith(file.folder, C0_Parent)
FLATTEN regexreplace(file.folder, "^.*\/([^/]+)$", "$1") AS SubFolderName
FLATTEN regexreplace(file.folder, C0_Parent + "\/", "") AS SubFolderWithPathRelativeToParent
FLATTEN regexreplace(C0_Parent, "^.*\/([^/]+)$", "$1") AS ParentFolderName
FLATTEN SubFolderWithPathRelativeToParent AS SubFolderWithPath
FLATTEN ParentFolderName AS pName
FLATTEN SubFolderName AS sName
FLATTEN choice(sName = pName, "C0", "") AS C0
FLATTEN choice(sName != pName, regexreplace(SubFolderWithPath, "^([^/]+)$", "C1"), "") AS C1
FLATTEN choice(sName != pName, regexreplace(SubFolderWithPath, "^([^/]+(\/[^/]+){1,1})$", "C2"), "") AS C2
FLATTEN choice(sName != pName, regexreplace(SubFolderWithPath, "^([^/]+(\/[^/]+){2,2})$", "C3"), "") AS C3
FLATTEN choice(sName != pName, regexreplace(SubFolderWithPath, "^([^/]+(\/[^/]+){3,3})$", "C4"), "") AS C4
FLATTEN choice(sName != pName, regexreplace(SubFolderWithPath, "^([^/]+(\/[^/]+){4,4})$", "C5"), "") AS C5
FLATTEN choice(sName != pName, regexreplace(SubFolderWithPath, "^([^/]+(\/[^/]+){5,5})$", "C6"), "") AS C6
FLATTEN choice(sName != pName, regexreplace(SubFolderWithPath, "^([^/]+(\/[^/]+){6,6})$", "C7"), "") AS C7
FLATTEN choice(sName != pName, regexreplace(SubFolderWithPath, "^([^/]+(\/[^/]+){7,7})$", "C8"), "") AS C8
FLATTEN choice(sName != pName, regexreplace(SubFolderWithPath, "^([^/]+(\/[^/]+){8,})$", "C9"), "") AS C9
FLATTEN C0 + choice(C1="C1", "C1", "") + choice(C2="C2", "C2", "") + choice(C3="C3", "C3", "") +
choice(C4="C4", "C4", "") + choice(C5="C5", "C5", "") + choice(C6="C6", "C6", "") +
choice(C7="C7", "C7", "") + choice(C8="C8", "C8", "") + choice(C9="C9", "C9", "")
AS CN
FLATTEN "  " AS INDT
FLATTEN {
"C0": "",
"C1": INDT,
"C2": INDT + INDT,
"C3": INDT + INDT + INDT,
"C4": INDT + INDT + INDT + INDT,
"C5": INDT + INDT + INDT + INDT + INDT,
"C6": INDT + INDT + INDT + INDT + INDT + INDT,
"C7": INDT + INDT + INDT + INDT + INDT + INDT + INDT,
"C8": INDT + INDT + INDT + INDT + INDT + INDT + INDT + INDT,
"C9": INDT + INDT + INDT + INDT + INDT + INDT + INDT + INDT + INDT
}[CN] AS SomeIndentation
SORT file.folder ASC
GROUP BY SubFolderWithPath AS G_SubFolderWithPath
FLATTEN rows.SomeIndentation[0] AS P_SomeIndentation
FLATTEN rows.SubFolderName[0] AS P_SubFolderName
`;
// V53. define h_result:
// run the s_DQL_multiline_with_newlines via dv.query and assign the result to h_result
// #####################################################################
let h_result = await dv.query(s_DQL_multiline_with_newlines);
// V55. output h_result:
// #####################################################################
if (h_result.successful) {
// Display the original data according to h_result.value.type
switch (h_result.value.type) {
case "table":
// TABLE:
dv.table(h_result.value.headers, h_result.value.values);
break;
case "list":
// LIST:
dv.list(h_result.value.values);
break;
case "task":
// TASK:
dv.taskList(h_result.value.values);
break;
case "calendar":
// CALENDAR: run a Q78_DQL10c
dv.execute(Q78_DQL10c);
break;
default:
// do nothing
}
} else {
dv.span(h_result.error);
}
```