Shortcut Query Buttons

A 'shortcut query' button is simply a button that performs a pre-coded query. Pedserve includes various shortcut query buttons as standard on the animal search page - such as the 'All Animals', 'All Males' etc. buttons. Effectively they are buttons that hyperlink to search results screens with URL parameters hardcoded for a specific search. Hooks are provided so you can add your own shortcut query buttons to the various search screens.

E.g. the hookAnimalQueryShortcuts_Add hook is responsible for adding shortcut query buttons to the main animal search screen. As supplied, this hook function looks like this:

sub hookAnimalQueryShortcuts_Add {
        my ($rmQueryPanelInfo, $strPanelPrefix, $strScriptSuffix,
            $strOtherURLArgs, $rmArgsEx) = @_;

        # Defer to an inbuilt function to add the standard pp query buttons:
        &pdsHookStdImpl_AnimalQueryShortcuts_Add(
                $rmQueryPanelInfo, $strPanelPrefix, $strScriptSuffix, $strOtherURLArgs, $rmArgsEx);
}

... which causes the inbuilt shortcut buttons to be added. But we can extend it to add a button that will list all animals that are parents - i.e. have one or more descendants, like this:

sub hookAnimalQueryShortcuts_Add {
        my ($rmQueryPanelInfo, $strPanelPrefix, $strScriptSuffix,
            $strOtherURLArgs, $rmArgsEx) = @_;

        # Defer to an inbuilt function to add the standard pp query buttons:
        &pdsHookStdImpl_AnimalQueryShortcuts_Add(
                $rmQueryPanelInfo, $strPanelPrefix, $strScriptSuffix, $strOtherURLArgs, $rmArgsEx);

        # Initialise a map of URL arguments that will define our
        # shortcut query:
        my %mURLArgs = ();
        &pdsPrepackagedQueryInit(\%mURLArgs, $strPanelPrefix, 'a', 'All With Descendants');

        # Add search term. This is the bit that limits the records to those where
        # the given field (A_PRO_COUNTCHILDREN) is non-zero:
        &pdsPrepackagedQueryAddTerm(\%mURLArgs, $strPanelPrefix, &pdsGetQueryDef('A'),
                                        'A_PRO_COUNTCHILDREN', 'int-ge', 1);

        # Now we create the target URL that is this query:
        my $strScriptArgs = &pdsJoinURLArgs($strOtherURLArgs,
                                                &pdsMakeURLArgsFromMap(\%mURLArgs));
        my $strURL = &pdsMakeScriptURL($strScriptSuffix, $strScriptArgs);

        # Finally we add this as a prepackaged query item to
        # the query panel, with given title:
        &pdsQueryPanelAddPrepackagedQuery($rmQueryPanelInfo,
                                              'All With Descendants', $strURL);
}

... which results in a search screen that looks like this.

The following table lists all the hook functions the system exposes for adding shortcut query buttons.

File Hook Function Search Screen
pedserve-hook-animalqueryshortcuts.pl hookAnimalQueryShortcuts_Add Animal Search
pedserve-hook-familyqueryshortcuts.pl hookFamilyQueryShortcuts_Add Family Search
pedserve-hook-matingqueryshortcuts.pl hookMatingQueryShortcuts_Add Litter Search
pedserve-hook-auxqueryshortcuts.pl hookAuxRecordQueryShortcuts_Add User-Defined Records Search
pedserve-hook-userqueryshortcuts.pl hookUserQueryShortcuts_Add Users Search (user accounts)
pedserve-hook-historyqueryshortcuts.pl hookHistoryQueryShortcuts_Add History Search (activity logs)
pedserve-hook-loginqueryshortcuts.pl hookLoginQueryShortcuts_Add Logins Search

Custom Query Button
Custom Query Button

USEFUL LINKS:
 EULA
 Pedserve Editions
 Sample City
 Consultancy
 Data Preparation
 Installation
 Regular Expressions
 Similarity Searching
 Configuration File
 Setup Script
 Stylesheet
 Database Design
 Hooks
 Date/Time
 User Defined Fields
 User Defined Records
 Display Fields Definitions
 Ordering Fields Definitions
 Highlighting
 Page Layout
 Field Definitions
 Field Formatting
 Shortcut Query Buttons
 Plates
 Command Buttons
 Connecting to the Database
 Warning Footer Message