Excluding a tag from a list of tags grouped by tag (see text and example)

Use the regexreplace function.(DQL10)

Topic

Summary
  • How to exclude the tag(key) (left column) from the tags (rows.file.etags)(right column) as seen in the screenshot of the DQL01? (DQL10)

Test

Summary
  • dataview: v0.5.55

Input

Summary

dictionary files:

  • Location: “100_Project/02_dataview/Q74_GroupBy_etag/Q74_test_data”

folder: 03_three_etags

  • filename : dic_19640301
  • filen.ctime: “1964-03-01T19:30:50”
---
Date: 1964-03-01
---
#T03
#T04
#T05


folder: 04_three_etags

  • filename : dic_19640401
  • filen.ctime: “1964-04-01T19:30:50”
---
Date: 1964-04-01
---
#T03
#T04
#T05


folder: 05_three_etags

  • filename : dic_19640501
  • filen.ctime: “1964-05-01T19:30:50”
---
Date: 1964-05-01
---
#T03
#T04
#T05


folder: 09_one_etag

  • filename : dic_19640901
  • filen.ctime: “1964-09-01T19:30:50”
---
Date: 1964-09-01
---
#T09


  • filename : dic_19640906
  • filen.ctime: “1964-09-06T19:30:50”
---
Date: 1964-09-06
---
#T09


folder: 10_nested_etags

  • filename : dic_19641001
  • filen.ctime: “1964-10-01T19:30:50”
---
Date: 1964-10-01
---
#T10
#T10/P1


  • filename : dic_19641006
  • filen.ctime: “1964-10-06T19:30:50”
---
Date: 1964-10-06
---
#T10
#T10/P1


DQL01_FLATTEN_etags_groupBy_etag_and_TABLE

Summary

Main DQL

Code Name Data type Group By Purposes Remark
DQL01
_FLATTEN_etags
_groupBy_etag
_and_TABLE
file.etags:
1.[“#T03”, “#T04”, “#T05”]

2.[“#T09”]

3.[“#T10”, “#T10/P1”]
yes 1.To filter by file.etags

2.To sort by file.ctime in descending order

3.To FLATTEN file.etags AS etag:
3.1 To break up a list like file.etags in a file into each individual element in a file
3.2 To define a field variable etag as each element of file.etags of each page

4.To group by etag

5.To define a field variable etags_joined

6.To display the result as a table

Code DQL01_FLATTEN_etags_groupBy_etag_and_TABLE

Summary_code
title: DQL01_FLATTEN_etags_groupBy_etag_and_TABLE =>1.To filter by `file.etags` 2.To sort by `file.ctime` in descending order 3.To FLATTEN file.etags AS etag: 3.1 To break up a list like `file.etags` in a file into each individual element in a file 3.2 To define a field variable `etag` as each element of `file.etags` of each page 4.To group by `etag` 5.To define a field variable `etags_joined` 6.To display the result as a table
collapse: close
icon: 
color: 
```dataview
TABLE WITHOUT ID
      key AS "Tag(key)", 
      rows.file.link AS "Notes", 
      etags_joined as "Tags"

FROM "100_Project/02_dataview/Q74_GroupBy_etag/Q74_test_data"

WHERE file.etags
SORT file.ctime DESC

FLATTEN file.etags AS etag

GROUP BY etag AS G_etag

FLATTEN "• " + join(rows.file.etags, "<br>• ") AS etags_joined
```

Screenshots(DQL01)


DQL03_GroupBy_etag_and_Remove_key_from_etags_joined_and_TABLE

Summary

Main DQL

Code Name Data type Group By Purposes Remark
DQL03
_GroupBy_etag
_and_Remove_key
_from_etags_joined
_and_TABLE
file.etags:
1.[“#T03”, “#T04”, “#T05”]

2.[“#T09”]

3.[“#T10”, “#T10/P1”]
yes 1.To filter by file.etags

2.To sort by file.ctime in descending order

3.To FLATTEN file.etags AS etag:
3.1 To break up a list like file.etags in a file into each individual element in a file
3.2 To define a field variable etag as each element of file.etags of each page

4.To group by etag

5.To define a field variable etags_joined

6.To remove the key from the etags_joined

7.To display the result as a table
1.The DQL03 is based on the DQL01.
1.1 Purposes 6 is added.

Code DQL03_GroupBy_etag_and_Remove_key_from_etags_joined_and_TABLE

Summary_code
title: DQL03_GroupBy_etag_and_Remove_key_from_etags_joined_and_TABLE =>1.To filter by `file.etags` 2.To sort by `file.ctime` in descending order 3.To FLATTEN file.etags AS etag: 3.1 To break up a list like `file.etags` in a file into each individual element in a file 3.2 To define a field variable `etag` as each element of `file.etags` of each page 4.To group by `etag` 5.To define a field variable `etags_joined` 6.To remove the `key` from the `etags_joined` 7.To display the result as a table
collapse: close
icon: 
color: 
```dataview
TABLE WITHOUT ID
      key AS "Tag(key)",  
      rows.file.link AS "Notes",
      etags_excluding_key as "Tags"

FROM "100_Project/02_dataview/Q74_GroupBy_etag/Q74_test_data"

WHERE file.etags
SORT file.ctime DESC

FLATTEN file.etags AS etag

GROUP BY etag AS G_etag


FLATTEN "• " + join(rows.file.etags, "<br>• ") AS etags_joined


FLATTEN regexreplace(etags_joined, key, "") AS etags_excluding_key
```

Screenshots(DQL03)


DQL10_GroupBy_etag_and_Remove_key_and_extra_comma_from_etags_joined_and_TABLE

Summary

Main DQL

Code Name Data type Group By Purposes Remark
DQL10
_GroupBy_etag
_and_Remove_key
_and_extra_comma
_from_etags_joined
_and_TABLE
file.etags:
1.[“#T03”, “#T04”, “#T05”]

2.[“#T09”]

3.[“#T10”, “#T10/P1”]
yes 1.To filter by file.etags

2.To sort by file.ctime in descending order

3.To FLATTEN file.etags AS etag:
3.1 To break up a list like file.etags in a file into each individual element in a file
3.2 To define a field variable etag as each element of file.etags of each page

4.To group by etag

5.To define a field variable etags_joined

6.To remove the key and extra comma from the etags_joined

7.To display the result as a table
1.The DQL10 is based on the DQL03.
1.1 Purposes 6 is modified.

Code DQL10_GroupBy_etag_and_Remove_key_and_extra_comma_from_etags_joined_and_TABLE

Summary_code
title: DQL10_GroupBy_etag_and_Remove_key_and_extra_comma_from_etags_joined_and_TABLE =>1.To filter by `file.etags` 2.To sort by `file.ctime` in descending order 3.To FLATTEN file.etags AS etag: 3.1 To break up a list like `file.etags` in a file into each individual element in a file 3.2 To define a field variable `etag` as each element of `file.etags` of each page 4.To group by `etag` 5.To define a field variable `etags_joined` 6.To remove the `key` and extra comma from the `etags_joined` 7.To display the result as a table
collapse: close
icon: 
color: 
```dataview
TABLE WITHOUT ID
      key AS "Tag(key)",  
      rows.file.link AS "Notes",
      etags_excluding_key_and_comma as "Tags"

FROM "100_Project/02_dataview/Q74_GroupBy_etag/Q74_test_data"

WHERE file.etags
SORT file.ctime DESC

FLATTEN file.etags AS etag

GROUP BY etag AS G_etag


FLATTEN "• " + join(rows.file.etags, "<br>• ") AS etags_joined


FLATTEN regexreplace(etags_joined, key + ",|, " + key + "|" + key + "(?!/)" , "") AS etags_excluding_key_and_comma
```

Screenshots(DQL10)


Reference

Summary

Emojis

The groupBy, groupIn and Data structures

  • Q16_GroupIn: The DVJS10_Q1, The DVJS20_Q1 from Solutions

The Regular Expression: Negative Lookbehind(?<!A) + Non-Capturing Group(?:x) + Negative Lookahead(?!Z)