Skip to main content
ExLibris
  • Subscribe by RSS
  • Ex Libris Knowledge Center

    Analytics- How to create a button that redirects a presentation variable prompt search to Primo

    Created By: Yoel Kortick.  Ex Libris Senior Librarian.
    Created on behalf of: Lisa Wong. Metadata Systems Analyst. University of California, Santa Cruz.  tyleet@ucsc.edu
    Created on: Jan. 19, 2023
    It’s possible to create a button that will take input from Dashboard presentation variable prompts and redirect it to search those same terms in Primo. This would be useful for a report where the search terms fail due to the searcher omitting a word or typo'ing a term.
    Ex. A Dashboard with a Title and/or ISBN presentation variables prompts. The user searches for the book: "Wilted: Pathogens, Chemicals, and the Fragile Future of the Strawberry Industry" using the following criteria:

     

    clipboard_ec080ee36cf5e39edc563a7915881542a.png

     

    The search failed because the title is slightly incorrect. However, clicking on the “Try Your Search in Primo” button will launch the same search in Primo in another tab, and find the resource.

     

    clipboard_ee6d5abf31c1357c0494f4ecacd0eef2b.png

     

     

    The redirect is accomplished by creating a stub report who's sole purpose is to display the button in a narrative view. The button uses a similar method to creating links in an Analytic to redirect the search to Primo.

    Build the Base URL

     

       1. To configure, you need to get a Primo base URL template.

     

        2. Search any single term in Primo and copy the URL:

     

     

    clipboard_e366bb64d679d99598448afb448a75a2f.png

     

       3.     Paste the URL into Notepad:

     

    clipboard_e202a256465e206120d918790b0cc7a92.png

       4.     Find the phrase “any,contains,<term>”

     

    clipboard_eb729d26d1cbc98924b49906027d7a0ce.png

        5.       Replace that portion with @2, leave everything else the same. This is your new base URL for the button. Set this aside, we will need it for later.

     

    clipboard_e264efe05e640e4643ce4676d24d88938.png

     

    Create Dashboard Prompts

     

        6.       From the Analytics Menu, select Create->Dashboard Prompt

     

     

    clipboard_e54cca78a2de5602c48b4393194da864f.png

     

         7.       Select your subject area:

     

    clipboard_e06f6fda01c2e9f5f783d3d2e00ff982d.png

     

        8.       The prompt configuration window will open:

     

    clipboard_eeb691fcf23925ff4e79297e0ebd2cc8b.png

        9.       Click the green plus->variable prompt

     

    clipboard_e9e538d2d00c8b8631161f30020bc82aa.png

        10.   Beside the Prompt for line, set the pull down menu to “presentation variable”.

    a.       In the box next to presentation variable, type in a name for the title variable.  This will be the name you use in your reports.

    b.       For Label, type in the text that you want to appear to the user to prompt them to type in a title.

    c.       Click OK when done.

     

    clipboard_ec50d4b61e19870b532eb28ea94da8581.png

        11.   Repeat for the ISBN prompt. (for this example, the name of the variable prompt for ISBN is "isbn") You should have two prompts as shown below. Save your Dashboard prompt.

     

    clipboard_ef3e2a7f8bb6f60620e650f204b226a86.png

    Add Prompt to Report

     

        12.   To create a report to use a single title variable prompt, create your report with Normalized title and ISBN valid.

        13.   Add the filter on the normalized title.

        14.   Check the “Convert this filter to SQL” box, and click “OK”

    clipboard_ebf4fd9e036b5396f14ce6aa88a275900.png

        15.   Erase everything and paste in this SQL code: (note, if you called your variable prompt for the title something other than “title”, substitute that name for “title”)

    IFNULL("Bibliographic Details"."Title (Normalized)", ' ') LIKE LOWER('%@{title}{}%')

     

    clipboard_ea97e5dee0aed20bebe5347be5143ee27.png

        16.   Then click “OK”.

        17.   Now create the ISBN filter.

     

    clipboard_e15d27411cbe42a58293fe72407b7d459.png

    IFNULL("Bibliographic Details"."ISBN Valid", ' ') LIKE REPLACE(REPLACE('%@{isbn}{}%', ' ',''), '-' ,'')

    clipboard_eec2e6665bbf1076f71d1f7657d9b7566.png

     

        18.   Your two filters should look like this:

    clipboard_efc39732e1fcdfefaebdaa77cc8774de6.png

        19.   Now add whatever other column and filters your report requires. Save.

    Creating the button

     

        20.   Create a new analysis, the subject area does not matter. Drag in the MMS ID column, and filter on any single MMS ID in your database.

    clipboard_e4d76555e3b375e0bab6d45a0fec8047b.png

     

        21.   Now drag in a column. It can be almost any column (do not drag in counters or drill down columns). Click on the gear->edit formula

     

    clipboard_ec8fdf24540c7e1853938e66cf4bc5600.png

     

        22.   Erase whatever value is in the column formula box.

    clipboard_e0b732b725eb5e191958d1d5094d29830.png

     

     

     

    clipboard_ec980af8f0b5ffa2fd499b63ab0a09ce4.png

     

        23.   Copy the formula below, paste into Notepad, and substitute <title prompt name> with the name of the presentation variable prompt you configured. Substitute <ISBN prompt name> with the name of your ISBN prompt:

    REPLACE('any,contains' || ',' || '@{<title prompt name>}' || '%20' || '@{<ISBN prompt name>}' || '%20' , ' ', '%20')

    clipboard_e449498e89ce1e38eb02c70e6656bdca4.png

        24.   Copy and paste the formula into your empty column formula box. Check the "custom headings" box and change the column Heading name to "query string". Click “OK” to save the formula.

     

     clipboard_ec47d0699541e332d1a269942c500aecc.png

     

        25.   Now click on the "Results" tab to run the report. You won't have any values for the title and ISBN variable prompts because they haven't been input by the user yet.

     

    clipboard_e3729988ee33453762985636d78df6dfd.png

        26.   Click on the New View icon and select Other Views->Narrative

     

     

     

     

    clipboard_ea0f74d62fa7ac654dbab7e7bacc4d401.png

     

        27.   This adds a Narrative View to the bottom of the report:

     

    clipboard_eccda706c74629a00c2a26e025ecb510e.png

        28.   Hover over the narrative view until your cursor turns into a 4 pointed arrow. Click and drag it between the title and the Table views:

     

    clipboard_eeb97db10c698cb8285f7c38249a61c30.png

     

        29.   Click on the pencil in the Narrative View to Edit it:

    clipboard_ec33ce6728dcb1bfad4f798e23d308a3d.png

     

        30.   This will open the narrative view for editing:

     

    clipboard_e66b99518ddc040bb3fc2bd5c51883d92.png

        31.   Check the box next to "Contains HTML/JavaScript/CSS Markup"

     

    clipboard_e893c228888883e18a5cd1fe9481fa952.png

     

        32.   Copy this HTML Code for a button and paste into Notepad. Where it says <base URL>, paste in the base URL you created in step 5. The text "Try Your Search in Primo" is the text that appears on the button, and can be customized to whatever wording you prefer.

    <br><br><button title="button title" class="action primary tocart" onclick=" window.open('<base URL>', '_blank'); return false;">Try Your Search in Primo</button>

     

    clipboard_e6069d1d6c00cf3b5e3841f51992e79a3.png

     

    clipboard_e12b9d0f92fb8450890482b8b5e171759.png

        33.   Once you've dropped the base URL in, copy and paste the HTML code into the "Narrative" box in your Narrative View:

     

    clipboard_e84fe945601fec383f3f43640463883c8.png

        34.   You should see the button appear at the very bottom. Now click "Done".

     

    clipboard_e358fee8101f9cb19191673b5772504f3.png

     

        35.   Your report will now look like this:

     

    clipboard_e4d80c3012b484474b583289caa0be5ae.png

     

        36.   Now we just need to hide the columns so that they won't display. For each column, click "Column Properties"

     

    clipboard_ec816a70e36f21c38a54b20c2d7275371.png

     

    Click on the Column Format tab and check the box next to "Hide":

     

    clipboard_ed1787afeedb6c0e27c66c0496724fba5.png

     

        37.   Repeat step 36 for the query string column. When you click on the "Results" tab, you should only see the button:

     

    clipboard_e0b109198fb45eecc2c082ff65c2cc989.png

     

        38.   Create your Dashboard. Drag in the Dashboard prompt, the report containing only the button, and your title search report.

     

     

    clipboard_e4597b4f8d0f49ddb8473f884bf7b3952.png

        39.   Save your Dashboard and run it:

     

    clipboard_edeebcd0c5e57e4ca1b7ab14a7fba890f.png

     

        40.   Now, enter the title and/or an ISBN:

     

    clipboard_e9969a7764998fa11b2d7d3527cf56f6c.png

        41.   If the search fails, clicking on the "Try Your Search In Primo" button will now redirect the search to Primo:

     

    clipboard_e8e19ec6554336465588ecbca531b686a.png