• How Searches Work in VIC

    By Dave Leigh 2 decades ago

    Don reported some trouble with the search form and wrote to me for more information. This is basically the information that I gave him, and I thought it might be useful if I passed that information on to others here.



    When you ask to "Search" for related documents in VIC, no actual search is performed… at least not in the sense of executing db.Search(). For speed I opted for and alternate method. I use a single category embedded view in a temporary document using the "Search" or "SearchEmails" form.



    It's more like a game of Mousetrap than an executable routine, in that it depends on a lot of components interacting. Assuming that the proper fields in the VIC documents themselves are properly populated, it should Just Work (tm). Here's the explanation, starting from the bottom up:



    There is a multi-value text field called Associations that appears on every VIC document. This field contains a list of document IDs that are related to the current one. If I create a Journal Entry that's associated with a contact then Associations will contain the Client_ID and the Org_ID would typically appear here. A product demo or conference would have more… the vendor's ID, a product ID, conference participants, etc. The important thing to remember is that there's a single list that contains the IDs of any person, company, or thing that's referenced by this document.



    Every VIC database has a (DocsbyAssociation) (aliased "Associations") view that contains all of the documents in the database, keyed on the Associations field. Since Associations is a multi-value field, (DocsbyAssociation) splits these up into multiple view entries, one for each ID in the list.



    The Search form leverages this view by displaying it as a single category embedded view which limits the display to only the Associations values that match the SearchID field on the Search form.



    A Search doc is a temporary thing created by the (vaShow*) agent (for example, (vaShowJournalEntries)). Once one of these agents creates the Search doc, all it does is populate the Search doc's header fields and the results are instantly displayed with the Search doc. Most of the fields on Search are for display purposes only… the only field that's functionally important is SearchID.



    TROUBLESHOOTING:



    If Searches aren't working, the only reason should be that (DocsbyAssociation) came up empty. I'd look at the following:

    Is SearchID on the Search form being populated? If not, the problem's in the (vaShow*) script.<br/>
    Does the (DocsbyAssociation) view actually contain anything? If not, then I'd look at the JournalEntry docs to see if there's anything in the Associations field, and if not, why not? You should always associate Journal Entries with a contact and/or org,<br/>
    



    BUG:



    While looking at this for Don I noticed some garbage that hasn't affected its functionality on my system. Originally when I coded this I used some Formula Language and pushed the SearchID value into the Notes.ini file. I replaced that code with the vaShow LotusScript agents, but apparently I stuck the original code in the SaveOptions field for some reason. SaveOptions should just contain "0", so I'll be replacing that in the next release.



    end of message*