Hello RichCPT:
I don't know if i did understand you correctly, so if a make assumptions in my response, please clarify to further help you out with this. In my case, i have a table that like you i need to make search of different parameters for a API server. In my case (and for what i understand on your post), you need to get the data from one specific table.
First, y declare my view in local data like this (i did simplify the file structure for the example). The idea here is to apply a filter or multiple filters as needed.
Keep in mind, is not a good idea to send all the data without any filter because, if the file has much records is gonna take long time or connection timeout. Or even worse, slowdown your system
This should work with any database. Maybe there are ways to make this much simpler, but this is what works for me using Btrieve database (Actian - Formely known as Pervasive)
Please check the included example and hope it helps.
!Defined view
View:PersonView ViewManager
PersonView VIEW(Persons)
PROJECT(PER:id)
PROJECT(PER:PersonName)
PROJECT(PER:eMail)
PROJECT(PER:Telephone)
PROJECT(PER:Region)
PROJECT(PER:County)
PROJECT(PER:Ethnicity)
PROJECT(PER:Education)
END
!Then in the Service Method Embed point do the following
DO OpenFiles
CLEAR(PER:Record) !Reset the file for the sake of cleaness
FREE(Q:ClientsSearchResult) !this queue is the return Queue in the method
CLEAR(LocSortOrder) !CString variable
GlobalErrors.Init !initialize GlobalErrors object
View:CustomersView.Init(CustomersView,Relate:Persons) !initialize View:Customer object
LocSortOrder = View:CustomersView.AddSortOrder(PER:ByID) !add sort ByKey or anything else
View:CustomersView.SetSort(LocSortOrder)
IF (LEN(Region) > 0) !API Parameter asuming is string
View:CustomersView.SetFilter('LOWER(PER:Region) = <39>' & LOWER(Region) & '<39>','1')
END!IF
IF (LEN(County) > 0) !API Parameter asuming is string
View:CustomersView.SetFilter('LOWER(PER:County) = <39>' & LOWER(County) & '<39>','2')
END!IF
IF (LEN(Ethnicity) > 0) !API Parameter asuming is string
View:CustomersView.SetFilter('LOWER(PER:Ethnicity) = <39>' & LOWER(Ethnicity) & '<39>','3')
END!IF
IF (LEN(Education) > 0) !API Parameter asuming is string
View:CustomersView.SetFilter('LOWER(PER:Education) = <39>' & LOWER(Education) & '<39>','4')
END!IF
!set the defined filters above
View:CustomersView.ApplyFilter()
View:CustomersView.Open()
View:CustomersView.Reset(1)
LOOP UNTIL View:CustomersView.Next()
Q:ClientsSearchResult.AccountNumber = PER:id
!and so on with the other colums in the View
ADD(Q:ClientsSearchResult)
END!LOOP
View:CustomersView.Close()
View:CustomersView.Kill()
DO CloseFiles