Gossamer Forum
Home : Products : DBMan : Customization :

separate contents from fields, then sort

Quote Reply
separate contents from fields, then sort
I have a field called "keywords," containing keywords for the record, separated by commas. I would like to list all the keywords from all the records in one alphabetical list (an index of the database). Can someone help me? I can use any delimiter- I'm just using commas now.

thanks, Sigrid
Quote Reply
Re: [sigrid] separate contents from fields, then sort In reply to
I think I can help you. Are you also planning on "grabing" a record number(s) along with the keywords or building links back to the records, or will just the list of keywords suffice?
Quote Reply
Re: [joematt] separate contents from fields, then sort In reply to
Thanks! I would like the list of keywords to link to the appropriate record(s). If more than one record matches the keyword, I would like them all to be listed. I'm using the short/long display, so if there is more than one record, I would like it to list the short display, but if there is only one, go to the long display- just like the search.
Quote Reply
Re: [sigrid] separate contents from fields, then sort In reply to
Well of course that makes it somewhat more complicated. Smile There are several MODS available that do "something" like that, with the exception of your multiple keywords in one field.

I looked at the standard db.cgi and I find that it setup to handle multiple keyword in a field within sub split_decode. The split_decode is used in the build_select_list subs. I know you are not building a select list, but the code could be modified to build your index.

The first MOD that comes to mind (not sure the format fits your desires) is the spreadsheet MOD, as it sorts, displays multiple fields, and creates links. So maybe after a running the record through the split_decode sub you could use the spreadsheet MOD?

I too would like to be able to build a "traditional" index from dbman using multiple keywords in a single field, ( I have been working on it on and off for some time ) it will be used for an annual research report. I currently build a static index from a database using many-many steps, the final format I desire can be seen at the link below. This is what I am calling "traditional", let me know if this is the layout you want or something else.

http://mccoy.lib.siu.edu/...dex-weed-common.html
Quote Reply
Re: [joematt] separate contents from fields, then sort In reply to
That isn't exactly what I have in mind, but it would work. Ideally, I would like (for example) "blackeyed-susan" to be a hyperlink, that, when clicked on, would retreive the long record for 522. "buttercup, smallflower" would retreive the short records for 157, 179, 351, 357, 507 and so on.

I will take a look at the mods you mentioned.
Quote Reply
Re: [sigrid] separate contents from fields, then sort In reply to
Take a look at the Categories MOD at

http://www.jpdeni.com/...s/ListCategories.txt

BTW, the link on JPDeni's site points to a .html file, but the file is a .txt

the link above will work.

The short vs long part should work "automatically" since that is decided based on the number of hits in a search.

The thing you need to do is get the multiple keywords out into separate fields. Keep me/us updated.
Quote Reply
Re: [joematt] separate contents from fields, then sort In reply to
I'll try, but I'm not much of a programmer. Here is some code from my links database- it takes items, then alphabetizes them like I want. I'll try to stick something like this in, but if anyone wants to help- I would appreciate it.

#################
@alpha = split(/<br>/,$links);
foreach $line (@alpha) {
$jl = join (">",(split(/>/,$line))[1],(split(/>/,$line))[0]);
push @alpha2,$jl;
}
@alpha4 = sort @alpha2;
shift @alpha4;
foreach $line2 (@alpha4) {
$jl2 = join (">",(split(/>/,$line2))[1],(split(/>/,$line2))[0]).">";
push @alpha3,$jl2;
}
$links2 = join ("<br>", @alpha3);