on 10-26-2014 9:06 PM
Hello Friends,
I have a specific requirement to search based on fields that are not necessarily the part of entity whose records I am expecting back in the result set.
Obviously for $filter to work, the field to be searched on should be part of the entity structure, but the field doesn't quite belong to the entity in its pure form.
Just to make it clear with an example... let us say I want to search for customer records but based on MPRN field (Meter Point Reference Number) which really should belong to Meter entity instead of customer entity. If the field does not belong to customer entity, I can't pass this search field in the url using $filter on Customers entity.
This (I think) leaves me with 2 options...
If this has made any sense, can I request for some recommendation between the above 2 options or even a third and a better option may be?
Kind Regards,
Jay
Another possible option would be to use OpenSearch, in fact this is the easiest way to achieve the requirement.
If you do not know much about this, you can have a look at Home - OpenSearch.
OpenSearch is suitable for situations where you want to perform free search based on a search template without bothering much about the entity Structure. It is a very old feature available from SP4. Eventhough you do not find much documentation on it, it is just a 'button click' on SEGW without much work.
Step to perform
In transaction SEGW, for your entity select the 'Searchable' checkbox like the picture below
(and you are done).You will find much more information in the F1 help documentation.
How to check it ?
Now if you run the metadata, you will find the url of the search template
If you visit the url http://<service url>/<openserach_href>, where <openserach_href> is the href highlighted above, you get the search template like the below one,
The template describes how one can perform an free search on entity set 'testSet'. For example, if you use the url,
https://<SERVICEURL>/testSet?search=anything i want to search
You get the search value in GET_ENTITYSET method of your Data Provider Class, in parameter IV_SEARCH_STRING. Here you are free to use your search string to select anything and return the data.
I think this can be used for your scenario.
Regards,
AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Atanu. This is definitely easier and better way.
Krishna / Atanu,
Many thanks for your responses.
Atanu - I agree openserch is the best approach to tackle the scenario I described.
Kind Regards,
Jay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Jayesh,
I would prefer a Function import in this case. Function Import can take the URL parameters (your search term) and return an entity set.
Regards
Krishna
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.