Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Filtering attribute tables
/*
****************************************************************************************
****************************************************************************************
****************************************************************************************
NOW HOSTING CODE VIA MY MAIN GITHUB REPOSITORY FOR ROAM SO THAT USERS CAN LINK DIRECTLY TO THE CODE AND AUTO UPDATE
GO HERE FOR INSTALLATION INSTRUCTIONS: https://github.com/GitMurf/roam-javascript#installation
****************************************************************************************
****************************************************************************************
****************************************************************************************
*/
@GitMurf

This comment has been minimized.

Copy link
Owner Author

@GitMurf GitMurf commented Oct 9, 2020

IDEAS:

  • Create a custom function to parse the number values for aggregation to add thousands separators.
  • The advanced regex I had working doesn't work on all browsers and definitely doesn't work on ipad.
  • Add option to filter for "NOT Blanks"
  • Giant attribute tables take a bit of time... try to optimize looping
  • IDEA: Not going to be able to get block creation dates/times. But next version in maybe a few days i think i can add "between" operator to filter a column that has daily note date page links between x and y dates you choose.
  • IDEA: pivot table / subtotal style aggregations. In a column tell it to SUM and then add that sum next to row count for the filtered rows.
  • IDEA: pivot table / subtotal style aggregations. In a column tell it to SUM and then add that sum next to row count for the filtered rows.
  • So for me I have a attribute table for invoices I send to clients. Value:: is one of them with the invoice amount. And client:: is another. So I’d like to be able to filter for client a and then show how much I’ve invoiced them.
  • Idea: I am going to add grouping next. Term1 {and} {(} term2 {or} term3 {)}
  • Filter for TODO vs DONE (suggested by David Eaton)
  • Do you mean you may have a column that has TODO items in it and other items may not be a todo (ie no check box)? And you want to be able to filter for just the TODO items?
  • I want to filter TODO items that have the attributes for the table, but not have DONE items included.
  • So in the first column there will basically be a bunch of either TODO or DONE items. Theoretically they should all have checkbox in them it is just a matter of whether they are “checked” (completed) or not.
  • And then you want to be able to filter for either “checked” (completed) ... aka DONE... or not checked... aka TODO?
  • Thought is to use {t} for TODO and for DONE can use {done} "{d}" is already used for standalone date. Although maybe change that to {dt}.

image

@GitMurf

This comment has been minimized.

Copy link
Owner Author

@GitMurf GitMurf commented Oct 15, 2020

image

image

image

image

@GitMurf

This comment has been minimized.

Copy link
Owner Author

@GitMurf GitMurf commented Oct 15, 2020

Attr Table Filter DEMO

@GitMurf

This comment has been minimized.

Copy link
Owner Author

@GitMurf GitMurf commented Oct 15, 2020

Couple "rules" when it comes to the saved filters:

  1. Child block with the saved filter must be shown (ie. NOT collapsed)
  2. Child block with filter must NOT be in edit mode (ie. click out of the block before trying to filter)
  3. Current filter for that column must be empty to apply the saved filter.

zVKiOsuUFG

@GitMurf

This comment has been minimized.

Copy link
Owner Author

@GitMurf GitMurf commented Oct 15, 2020

Just added ability to filter for TODO and DONE items.

TODO filtering

@GitMurf

This comment has been minimized.

Copy link
Owner Author

@GitMurf GitMurf commented Nov 17, 2020

Moving development/updates back to regular GitHub repository so that users can set their roam/js source to the Repo link to keep up-to-date automatically. https://gitmurf.github.io/roam-javascript/#attribute-table-filters

@zzzgithubzzz

This comment has been minimized.

Copy link

@zzzgithubzzz zzzgithubzzz commented Mar 10, 2021

Wow! Absolutely amazing.. Thank you 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment