Multiple search fields, multiple records in single request

Multiple search fields, multiple records in single request

  
Hi, 
I haven't been working with OutSystems very long and this will be my first post on the community forum, so here goes :) 

I am working with a webservice which will return multiple records, based on a search. One could compare the service to a phonebook search, where we can search based on Name, Address, Country, ZipCode. The user can search for every record with a certain zipcode, or for all records with a certain Name, so none of the fields are mandatory (as long as 1 field is filled out).

The search itself is based on a record list with the following structure:
- AlwaysIncludeUnknownCountry
- Connect
- ExcludeCommonWords
- Group (More than one group tag can be present in the request)
   - Connect
   - Match (More than one match tag can be present within 1 group)
      - Field
      - Keyword
      - Level
      - Scope
      - Type

From a user perspective, I have created a screen where they can fill out Name, Street, Zip, etc. Then they hit the search button and the webservice should return the results they are after. 

So for one search on e.g. Name and Street, I will have to create one group, with two "Match"-records, one with Field=Name and Keyword='NameValue', one with Field=Street and Keyword='StreetValue' (and obviously the rest of the fields within the group record). 

The issue I encounter is that I am not sure how to handle this "Multi fields to Multiple records" trick. My mind simply wants to create a record list variable for the match-tag, and assign a new record per field. I have yet to find a way to implement this though...
(For now I am ignoring the multiple group work flow, as that will complicate things even more, so just one group with all the match records will have to be created).

Has anyone got any experience with this way of working? Or maybe that I am stuck on a wrong train of though?

Thanks in advance,

/Jeroen Westerhuis
Hi Jeroen,

First of all welcome to the forums: I hope you enjoy your time here! :)

As for your question, I couldn't quite understand if you only mean to do the "front-end" side (the form that reads the filters) or you also meant to do the web service in the OutSystems platform. I assumed you want both.

Basically, yes, on the front-end you can build up a RecordList with a pair name/value of which filters to use. Then you would call the Web service passing that Record List.

Once on the WS side, you can iterate the record list and, here's the magical bit :), build a dynamic filter section for the query to your Directory. Then just pass this filter section into an Advance Query as an Expand Inline parameter.

I have put together a simple eSpace where I actually did both sides of the process (so the eSpace exports a Web Service and ALSO consumes its web service) in one place for you to have a look. You can filter by name or street or both (just leave blank to show all records).

The main point for you to look at is the LookupService > Lookup Web Service method.

Let me know if this helped or you have any doubts,


Miguel
Hi Miguel,

thanks for the reply and the oml. This really helped a lot and it seems that I have been able to create the correct way to consume the webservice! It did give me a better understanding of how to assign record lists in the agile platform.

Thanks a million,

/Jeroen
Hello Everyone.
I want to display multiple records using foreach can anyone help me with that.

Regards,
CR