NetSuite: Emulate Global Search - search

I'm curious if anyone has come across this question before.
I've been asked a few times if there is a way to emulate the Global Search functionality into another field.
I'm guessing Inline HTML, potentially triggered by Client Script, but I don't know where to start.
Anyone worked with the Global Search before?

N/search has a search.global method that returns a search result with columns: name, result, info1, info2 (and id and recordType) It has a promise method that allows use in a client script.
It's all up to you how you display the results though.
depending on what you are trying to do another search like operation but more focused is the field.getSelectOptions method. This lets you do a contains, is or startswith search for a matching value for a field. Great if are trying to script a transaction field where the normal select list could be 100k long.

Related

Exception occurring if search box (with suggestions) is used too quickly

I add search suggestions to my search box like so...
var s = document.querySelector(".win-searchbox");
s.addEventListener("suggestionsrequested", function (e) {
e.detail.searchSuggestionCollection.appendQuerySuggestions(["one", "two", "three"]);
});
But when I run the app and use the search field too quickly, it throws one of two exceptions deep in the ui.js file having to do with adding to and removing from the suggestions list. I assume that the async script is trying to access list items that are taken out of existence already (because I'm navigating quickly... search, enter, type a new search, enter, etc.).
I can't figure out how to debug this or find a way around it. Is there a null check or something that I need to put somewhere? Thanks.
The problem was the page was navigating back to itself when the query was submitted, so I searched too quickly it tried to do navigations overlapped somehow and threw the exception. The fix was to simply replace the filter function on the ListView when the query was submitted. Obviously, this is the better way to do it anyway and the performance was dramatically improved.
I had an issue similar to this with the search box control if I searched rapidly to navigate to the search results page. My suggestions are ranked values from a 40K of JSON objects, and the result returns within 100ms. I made a global variable to hold the search promise and canceled it in my navigation onnav event.

Can I call a search help programatically, with some parameters already filled in and non-editable?

I have collective search help S_MAT1 defined for data element MATNR.
I want to invoke programatically the append search help S_MAT1_APPEND, this means that when I press a button in an ALV list, I have to trigger a search dialog, like that for a search help.
I'd also want to be able to fill in some parameters automatically, and not let the user change those.
I am expecting to find a function module that does this.
HELP_START doesn't seem too documented, and doesn't seem to be what I want.
Can this be done?
Yes. Use the function module F4IF_GET_SHLP_DESCR to get a description of the search help, then call F4IF_START_VALUE_REQUEST with the description data. Be aware that you need to set SHLP-INTERFACE-VALFIELD to X for the fields you want to get back from the value help.

Use EE Search Module to search custom fields

I'm sure this is something simple for which I just haven't found the documentation:
I have a website with a member directory. All of the member data is stored in a members channel, which uses a variety of custom fields – some of which are part of the P&T Field Pack.
I use a Safecracker form to enter the data, and it renders the custom fields beautifully:
What I want is essentially the same form, but have it perform a search, instead of enter the field data.
I've scoured the Search Module documentation, but can't find information on how to search individual fields, let alone how to render them. I've also searched the Safecracker documentation for how to configure it to search (the ideal solution).
How do I do this?
Any help would be appreciated.
Thanks!
ty
EE's search module won't do what you want - it's more of a general search tool, and its "Advanced search" form is less about custom fields and more about things like channels and categories.
You want to look at Solspace's Super Search. It's much more powerful, and will allow you to do exactly what you want in terms of your query - though you will have to build the form manually (i.e., you won't get the SafeCracker-style simplicity of using {field:field_name} to have your form fields output for you).
I would also recommend checking out SuperSearch.

Passing form data to another form via url in lotus

I am working on a new web app in lotus/domino. I am newer to lotus/domino programming, so forgive me for not knowing something simple.
What I am trying to do is display a table of information, with one of the columns containing a link. The link is formatted like [http://server/app.nsf/form?openform&ideaNum=1&var2=foo2]
How can I retrieve the information from the url, to get information from a view or a document?
So far I have tried to access the query string in the webQueryOpen event, but lotus runs the agent before the DOM writes to the browser, the query_string isn't available.
I am not sure how else to get information from one form to another in lotus.
Thanks for the help.
-Kris
If you're passing multiple params in the query_string, you can get Domino to do a bit more of the work for you. There's an Function command - UrlQueryString - that can format the params into a list, delimiting at the "&".
E.g. server/app.nsf/form?openform&ideaNum=1&var2=foo2
becomes a list:
openform
ideaNum=1
var2=foo2
To use it, on the destination form create a multi-value text field called something like "QryStringList".
Set it to be computed when composed, and set it's value to #UrlQueryString.
In your WebQueryOpen agent, you can access the params as doc.QryStringList(0), docQryStringList(1) and so on, if you're using Lotusscript.
I'm fairly sure I put this together using info from the IBM/ldd forum, but the exact source is lost in the mists of time and memory, so apologies if I've copied someone's post.
Just as a follow up, I found that you are able to specify an on form variable named the same as QUERY_STRING. The variable is actually a reserved term for Lotus, so Lotus pre-fetches the variable before running the information out the browser.
Due to the pre-fetching, you are able to access the url information during the webQueryOpen event.
I hope this helps someone else looking for the same type of functionality.
-Kris

Designing a one EVERYTHING search box (date+address+keywords)

I'm storing information about local "events". They are described by 3 things - address, date, keywords(tags). I want to have only one search box for at least address and keywords. The date might go to a separate field. I'm assuming that most people will search for events that are taking place "today" so this filter won't get that much traffic.
I need those addresses to be correct (because I'm geocoding them afterwards) so I need to validate them before submitting the form and display a list of "did you mean" if a user made a typo there. I can't do life search here. I can do a live search on keywords. Keep in mind that a user can make a typo there too and I want to catch that.
Is there a clever way to design the input's parser in this case to guess which is supposed to be address and which keywords?
OR
Is there a way to actually parse it as user is entering his query? Maybe I should show autocomplete hints for keywords, after 3 first characters are entered, and if user denies to use them then to assume that it's a part of an address he's typing.
What do You think?
Take a look at Document Cloud's Visual search
http://documentcloud.github.com/visualsearch/#demo

Resources