I've reconsidered the problem I posted earlier on, about sorting radio fields. Note that I'm not at all good at perl, so apologies if some of my problems are all too primitive.
What I want to do: A bibliography database should, for each entry, contain the information whether it is an article or a book. So I have devised a field "category", as a radio field with the options "article" and "book".
When a user searches the database by the field "name", search results should be printed as follows:
"These are the publications by "name"
Articles:
(Here follows a list of individual articles, sorted ascending by field "year")
Books:
(Here follows a list of individual books, also sorted ascending by field "year")"
Problems/Questions:
- How do I add code that makes dbman check on whether the search results contain entries where "$rec{'category'} eq "article"", and if so, print the heading "Articles:", and do so only ONCE? If I add something like "if ($rec{'category'} eq "article") {print qq|Articles:|;}", then I get the heading for EACH article result individually, but not for the entire section of articles. I guess the "for (0 .. $numhits - 1) {&html_record (&array_to_hash($_, @hits));}" in sub html_view_success is responsible for this, but don't know what to change.
- If "sort ascending by field "year"" is specified in the search-form, will dbman then sort ALL results by year (which I fear will be the case), and do I have to use the multiple sort mod in order to have it sort first by category, then by year? Plus: If I let dbman sort by category, where the values can be "article", "book" and "translation", is there a way to specify a sorting sequence which is neither ascending nor descending, like "book" > "translation" > "article"?
as usual - many thanks in advance,
kellner
What I want to do: A bibliography database should, for each entry, contain the information whether it is an article or a book. So I have devised a field "category", as a radio field with the options "article" and "book".
When a user searches the database by the field "name", search results should be printed as follows:
"These are the publications by "name"
Articles:
(Here follows a list of individual articles, sorted ascending by field "year")
Books:
(Here follows a list of individual books, also sorted ascending by field "year")"
Problems/Questions:
- How do I add code that makes dbman check on whether the search results contain entries where "$rec{'category'} eq "article"", and if so, print the heading "Articles:", and do so only ONCE? If I add something like "if ($rec{'category'} eq "article") {print qq|Articles:|;}", then I get the heading for EACH article result individually, but not for the entire section of articles. I guess the "for (0 .. $numhits - 1) {&html_record (&array_to_hash($_, @hits));}" in sub html_view_success is responsible for this, but don't know what to change.
- If "sort ascending by field "year"" is specified in the search-form, will dbman then sort ALL results by year (which I fear will be the case), and do I have to use the multiple sort mod in order to have it sort first by category, then by year? Plus: If I let dbman sort by category, where the values can be "article", "book" and "translation", is there a way to specify a sorting sequence which is neither ascending nor descending, like "book" > "translation" > "article"?
as usual - many thanks in advance,
kellner