Simple list of all the distinct values in a field

Hi all

I would like to generate (and later to search) a list of all the values that various tiddlers currently have for the foo field. That way I can see what values I have applied, and be more consistent as I apply new values.

Any clue what the list filter would be? And how to search the list to narrow down the search results?

You could try

[all[tiddlers]each[foo]get[foo]]

The each filter will select one tiddler title for each unique value of the foo field, and the get filter will get the value of the field from each such tiddler.

Once you have this list of field values, you could use a regular [search[search-term]] filter to narrow it down.

I hope this helps.
Have a nice day
Yaisog

Thanks Yaisog!

I ended up cloning $:/core/ui/AdvancedSearch/Filter and pasting an expanded version of your tip just above the search box for easy pasting.

[all[tiddlers]each[itemlabel]get[itemlabel]sort[title]search[]]

That works for me! Thanks again

Thanks @DaveGifford (and @Yaisog)

THAT is a very subtle but useful question/answer…

So useful, I think it would have a good place in the core (or at least, a core macro in the official release). What it needs I think is a fully fleshed out plan with a worked example UI/UX explaining where it would be surfaced (I’m brain dead right now and can’t think of one).

A configuration UI in Control Panel (checkboxes) denote which fields should have the facility enabled. When configured fields appear for editing anywhere in the wiki, the list of previously applied values are presented so that values can be selected. Make sense?

:white_check_mark: my-field
:white_large_square: other-field
:white_check_mark: another-field

I think @EricShulman did some work with edit-text/dropdown combos?

I think @TW_Tones has an eye for this kind of thing.

@CodaCoder: Is what you’re thinking of basically just to add the tag selection functionality for other fields (→ show a drop-down possibly with keyboard navigation, but without the pill shapes)? I guess much of the tag code could be used for that.
I have a feeling this was discussed before, but can’t remember.
Have a nice day
Yaisog

See TiddlyTools edit-list.html

As a quick test, in the “Try It Now” input (in the Info tiddler), I put:

<<edit-list tiddler:"TryIt" field:modified filter:[all[tiddlers]!is[system]each[modified]get[modified]sort[]]>>

In that file, the above filter finds 9 modified timestamp values (one for each non-system tiddler in the file).

With “timestamps” disabled (so modification dates are not automatically updated), select an item from the list and the modification date for the “TryIt” tiddler is set to the selected timestamp, allowing you to “backdate” the tiddler to match another existing tiddler’s modification date!

-e

Yes, without the pills, as you mentioned. Though I think the solution offered by @EricShulman scales better than the Tag popup.

Regarding the configuration part, I can imagine two additional columns appearing in CP here:
https://tiddlywiki.com/#%24%3A%2Fcore%2Fui%2FControlPanel%2FTiddlerFields

column+1 contains :black_square_button: :white_check_mark:

column+2 contains optional seed values (appended to the list regardless of previous use/existence).

I considered the tiddler info panel for all of 5 seconds… but CP reflects better the wiki-wide nature of this proposal. Even so, I’m not yet convinced CP is the correct place, either.

@DaveGifford your thoughts?

Traveling today. I got what I needed and have no feedback but will be following this for more cool ideas. Hey, time to board!

Eric, I’m seeing JavaScript errors with almost anything I try to do at the edit-list site. If this is a surprise, I’m happy to help troubleshoot.

Are they console errors like this:

$:/core/modules/editor/engines/simple.js:90 The specified value "..." does not conform to the required format, "yyyy-MM-dd".

or

$:/core/modules/editor/engines/simple.js:90 The specified value "..." does not conform to the required format. The format is "#rrggbb" where rr, gg, bb are two-digit hexadecimal numbers.

If so, it’s because the examples in the Info tiddler mostly use the same target tiddler and field or index, but a few of those examples are also using type:date or type:color parameters, which normally restrict the input to those specified types. As a result, when you use any of the other examples that target that same tiddler and field or index – which don’t restrict the input to those types – those specialized type:date or type:color inputs object to the value being entered.

If the examples each used different target tiddlers or different fields/indexes, then the errors would not happen. In normal expected usage of the edit-list macro, this overlap of targets typically won’t occur.

Similarly, when using the type:color with an edit-list that has a list of color names, the #rrggbb error occurs whenever you select a list item that is a color name, because the color name doesn’t fit the #rrggbb “required format”.

Nonetheless, in all cases, the inputs are still being correctly handled by the edit-list macro, and the value is properly stored in the target tiddler field or index.

On the other hand… if those aren’t the errors you are seeing, then yes, it is a surprise :frowning: and I’d appreciate whatever troubleshooting help you can provide.

thanks,
-e

1 Like

There are a set of different possible circumstances, sometimes we want one of the following;

  • The ability to edit the field, and add a new value
  • The ability to select from a list of predefined values. (and not necessarily already found in the field value)
  • Ability to make a selection from existing values in the same fieldname
  • Allow entry of any value NOT already existing in the same fieldname (When uniqueness needed)

One way to do this is to provide a filter to determine the possible values

Each of the above could be the only option for a given field, or more than one could apply to a particular field.

I think this global option is a great idea, and we can also provide a local include option as well.

The above ignores the different interfaces for different types of tiddler or selection eg text, tiddlernames, date, color etc…

Perhaps I do, my key focus is a broad and systematic improvement to field handling. I have found little interest and support until now but recently progress is occurring in a number of places and I do not have as much time to contribute :frowning:

  • Eg there is already a “Field Editor Cascade”

Except for the last one, which blocks entry of specific values in the edit field, the TiddlyTools <<edit-list>> macro can do this.

Go to https://tiddlytools.com/edit-list.html and create a new tiddler containing the following macro:

<<edit-list field:tags show:yes listwidth:fit listheight:fit
   filter:"SomeTag AnotherTag [all[tiddlers]tags[]!is[system]] +[sort[]]">>

As for the last objective, I might be able to add two new parameters to the <<edit-list>> macro:

  • unique:yes
  • exclude:...filter...

These would detect if the entered value matches either a value that was already used in the target field of another tiddler, or a value that is not permitted at all. It could then put up a notification message (or perhaps an $action-confirm dialog) to let the user know that the value is not allowed.

-e

1 Like

Hello Dave

Here’s another filter syntax that I use for this purpose:

[get[foo]enlist-input[]unique[]sort[]]

This has the advantage of using the unique filter operator.

1 Like

Eric I think your edit-list is a master piece. It is so comprehensive I think this will be a long term project of mine to understand it intimately.

Not withstanding this I hope to simplify the use of fields within tiddlywiki by building an easy to use “configuration space”. So we need to take edit-list or other solutions and use it to provision easy and de facto standards for field and form handling, always with an emphasis on simplification.

Now you guys are making me greedy.

Imagine in a sidebar tab, something like the edit-list but where each item has a plus next to it to create a new tiddler with parameters and one of them being adding that value to that field. And the list would also have a button to ‘create a tiddler with the parameters you set, plus a new value in that field’.

Too bad it can’t be done. TiddlyWiki is good, but there’s no way it’s that good. :slight_smile:

What do you think the “edit-list is” @DaveGifford ?

  • Because until you explain, I can’t understand what you just said.
  • Like what would it be listing that forms what is needed for new tiddlers?

I could be wrong, but I think @DaveGifford is asking for a way to drive tiddler creation by field. If you understand creating tiddlers by tag, this is the same except he wants to use fields.

So instead of “new tiddler with this tag”, create a tiddler with this field (and value).

Dave?

Isn’t that easy-peasy?

Hi Tones and Codacoder,

I just figured out how to do what I mentioned, using the list-search macro. I will upload later when I get home (no internet access on my laptop right now).

2 Likes

ok, back at my parents’ house with Internet.

https://giffmex.org/experiments/note.tsunami.html

Not something I intend to publish as a plugin or edition, just to show you what I was aiming for.

2 Likes