Jit.cellblock with Coll and search / find entries in list
Dear C74 friends,
Would you please assist me with a more elegant and flexible solution to use Jit.cellblock with Coll to make a basic search/find function possible?
The problem is, that I can not 'find' (so called 'find again'-idea of a basic text editor) more entries in the list if there are more similar symbols appearing later. Only the last item is listed, its impractical for me.
Below is the initial idea, I've borrowed some snippets from other Max-friends YP , Len Richardson and Geotrupede and mentioned in the patch there, with big thanks here.
So the main questions are:
Is there a better solution to exclude the first column (the Column header) from the 'find / search' action?
How to include similar symbols in the 'find again' action appearing earlier in the list (not in the Column header, of course)?
May I have your valued input?
Many, many thanks in advance!
Alfredo
You should have no problems addapting this to your needs.
Hello SA!
Thank you (again) for the assistance, I can't hide my ethousisasme, its just wonderful!
Very clear and efficient build, it works with different symbol lengths and finally with multiple search options. With a minor adaptation I can even search for numbers in the list too, that's I couldn't expect before.
Chapeau!
Again, many thanks,
Alfredo
You are welcome.
The thing is, cell search or coll search etc, makes no big difference,
only that if cell is in use, than it seems easier to evaluate row and column numbers.
In case of just coll, or even plain text, one would use line number and position in the line
using zl objects to mark position(s) of found matches.
Source Audio, that is indeed an elegant search solution.
I took it for a spin this AM, and immediately filed it away for future reference.
Many thanks!
Thank you for the additonal info.
Actually the idea of extra Jit.cellblock is very practical because it filters already the found items from the rest and its easy now to pick the right one from the group there. The second Jit.cellblcok I can put in a float/pop-window and spare much space when I do not need it.
As I understand you correctly, using of just one Coll with a Zl. objects will give me only the number(s) of the line(s) with the searching items, so I can look for it further in the list by scrolling with mouse, right?
The final idea of my little patcher is to search/find items, so that I can edit those quickly straight in the Jit.cellblock. It gives me more flexibility than editing in the plain coll-text and especially to avoid mistakes with formatting (like misspelling of comma's, semicolons, quotes), because those mistakes can destroy (cut away some data) the coll-list if I will safe it with mistakes in it.
I ment that seaching a coll, without any use of cellblock
can also be simply done.
And place results in new coll too if one wants to, like in the last patch I posted.
One just needs to combine line number, list position of found item and item itself.
Or reorder that list in whatever way one wants.
It needs few more objects because one has to extract position of found item in the list,
which cellblock dump allready provides.
--------
I am no fan at all when it comes to editing cellblock.
If one changes selection mode from inline edit to whatever else,
selected cell might hang and display previous and new entered value
on top of each other.
That bug has been reported quite few times since many years and has not been fixed till this day.
-------
Hello SA,
Before of all: again, thank you for the posts above!
My excuses for the delay, but I really needed some time to check (and a bit to understand your interesting patchers) you shared with us, especially the previous one, which is at some points (with red/blue cables) hard to understand for me.
Let me describe what I'm trying to achieve, but it does not work here.
1. to may always scroll the main Jit.cellblock if I use searching results in the second Jit.cellblock as your 1st patcher.
There something blocks the main Jit.cellblock from scrolling, possible the [sync click $1 $2 1 0] message;
2. to may have 'gapes' in the main Coll its index-numbering. This is because if I edit and delete sometimes complete lines from the Coll-list, I wish not to renumber those ones yet, just keep 'free numbers'-space between for later.
For this, I think, I must link the list of found items not to the cell-numbers in the list, but to the sequence numbers of the main search-Coll (those numbers are to catch after the [dump] message from the second-from-left outlet). But I can not modify your 2nd patch to achieve that: too difficult for me;
3. to may enter and search for the symbols and/or numbers with different lengths (it means between or without quotes), but still using a just single item from that symbol as the search therm.
If the symbol is short, quotes will automatic omitted (so we have already that); if the symbol long, the quotes will be in auto-added in the Coll-list. But if I wish to find that relevant symbol, I will never find it until I put the full-length symbol in the search field, its often long and impractical for me.
You think I wish too much?
BTW, yes, I do completely agree that Jit.cellblock is not a good solution for editing of the Coll-lists. I experienced this freezing many times. But to edit/copy/paste/renumber etc. the Coll-list items directly in the text-editor is also a big pain. As I told already: a little mistake (quotes, commas, semicolons etc.) on a small PC-screen destroys some data, I need to recover it from a backup.
So at this point I use the less destructive option: edit data in the Jit.cellblock.
Would you please assist me with my questions above? (It has no rush, because I have a gig next weekend and must concentrate on it a lot... so possible I could not react immediately).
Thank you for your patience and assistance!
Warm regards,
A
I would suggest searching and editing coll directly , it is much simpler,
coll warns you if syntax is not correct.
Same way one can make mistakes in cellblock.
---------------
1. I locked main cellblock so that only result cellblock selects and scrolls the cell.
Otherwise there would be chaos at the output because cell itself would trigger
searching and add items to results coll.
If you want to use main cell with mouse, one would have to insert gate
which only routes cell data when search is initiated.
Or use coll itself to search like in second patch I posted.
untick ignoreclick in inspector to enable the cellblock for mouse clicks.
2. you will have to replace the way found items get added to results coll.
Instead of inserting found items, you will need to use the column of the main cell,
which in fact is coll index.
To search for bbb in "aaa bbb ccc bbb" will produce few difficulties.
let's look at possible example :
22, 11 34 ratatat "aaa bbb ccc bbb" 100 bbb;
- one has to run coll lines through fromsymbol and iter the list so that each
occurrence of bbb gets found.
but as coll index can be stored only once, matching bbb would trigger
3 times in that line.
And - items in the list will not match the cells, because line without quotas
11 34 ratatat aaa bbb ccc bbb 100 bbb
will have 9 items instead of originally 6.
So again one has to insert new line in results coll for each position of the
found item.
Or reduce search result to 1 coll line or cell row.
Hello SA,
Yes, thank you for the quick replay. And (because a chaos here) I wish to add just one comment regarding your point 2. for today:
What I need, is search for bbb in "aaa bbb ccc bbb" to find the complete line (cell) wit the all "aaa bbb ccc bbb" in it and not the bbb only. I hope its easier to achieve.
More replays are to come...
you must break the symbol to search for bbb in any symbol,
being "aaa bbb" or "ccc 44 bbb" or anything else.
once symbol is separated, one has to iter the list to match bbb.
that breaks the cell address.
One would have to dump the coll instead of cell for search.
But what would you insert into coll/cell with found items ?
the whole coll line ?
And clicking on that line should select what in the main cell ?
Hello SA,
Please excuse me for the delay, I'm back to normal day-rhythm... and first thing is returning to this topic.
Actually, your second idea is brilliant and there is really not much needed to change. Its totally fine! I finally understood the principle of filtering items. The auto scroll/focus idea is very clear in your first patcher... Breaking the a long symbol "aaa bbb" into smaller parts works easy (as you told above) and it creates a list of the found items after (dump).
Just to answer your questions to make my needs clear.
"But what would you insert into coll/cell with found items ?" I would adapt the whole cell-(coll) line, the only thing is that I have to switch the it Selection mode of the Jit.cellblock before editing a cell. I can't adapt the index of Coll from Jit.cellblock, but its not really needed.
"And clicking on that line should select what in the main cell ? " Yes, it should select the relevant cell completely and auto scroll the main Jit.cellblock if it out of focus. But, again that mechanism is in your first patcher, so I needed only to integrate the [sync click] message in the second patcher and that's it!
So this question is solved thanks to your valued assistance and patience for me, who's still learning.
I keep thank you for this (and other topics you helped me), its very appreciated.
Compliments to SA!
Alfredo
I'm glad you managed to get it work.
Just as example another version here
Its just amazing, SA!
With only few objects it works as charm, with any words-lengths, numbers or multiple search items and all in free sequence-order independent from the original stored coll-lists.
I will reuse this one, because this really rocks.
10+ points!
PS (edit, I think you have a high-school Max-education/prof. experience, because of this 'smooth' patching... and you should get some $ for your level... really.)