cancel
Showing results for 
Search instead for 
Did you mean: 

Searching Flat Lookup Fields

Former Member
0 Kudos

I am trying to perform a search on a Flat Lookup table which has Flat Lookup fields in it. I need to find a specific record within this table and the field which I need to search is a lookup field. For reference let say I have the following

Table: Owners

Owners Fields: Facility (Lookup [flat])(points to FacilitySTN table), Name (String), City (Int), State (Int), etc . .

Table: FacilitySTN

FacilitySTN fields: FacilityID (int)(Display Field 1), FacilityType (String)(Display Field 2)

So I need to find a specific set records in the owners table and all I have to search by is the FacilityID and FacilityType. My first thought was to do a CatalogData.getRecordsByValue and pass it the facilityID and Facility Type as a concatenated String, but I get a GetRecord Error. Is there anything I can do short of pulling all the record from the Owners table and doing a bubble or linear search?

Just in case you would like to see. Here is the code I was working with to try to get the record.

ResultsSetDefinition rsd = new ResultSetDefinition("Owners");

rsd.AddField("owner");

A2iStringArray strarray = new A2iStringArray();

strarray.Add(String.valueOf(FacilityID) + ", " + FacilityType);

A2iResultSet rs = catalog.GetRecordsByValue(strarray, rsd, "Facility");

Thanks for any idea or thoughts on the matter

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

GetRecordsByValue and GetRecordId are alternatives to <b>Search Class</b>

Use the Search Class technique for your requirements.

<b>Steps:</b>

Get Search Instance.

Set Search Table

Add Parameters

Get ResultSetDefinition and define what data to return from search

Get A2iResultSet returned from Search

Example:

Search search = new Search(table name to be passed here);

SearchParameters sParam = search.GetParameters();

//get a new lookup parameter for the table/field combination

LookupParameter lookupParameter = sParam.NewLookupParameter("main Tablename to be passsed here, lookup field name to be passed here);

//find the mdm record id for lookup table facility id and facilty type. - You can use a search technque to arrive at this id as well

// add the new parameter to the search object

lookupParameter.add(recordid)

Hope this helps,.

Please mark helpful answers.

Answers (1)

Answers (1)

Former Member
0 Kudos

Thanks. That worked. Hope the points help.