cancel
Showing results for 
Search instead for 
Did you mean: 

How to get an object by searching attribute values

LeAnna_King
Champ in-the-making
Champ in-the-making

We are using an API to import data into OnBase as WorkView objects. The import works great, except it creates a new object instead of updating an existing one if it is there. I need a way to search the attributes for a value and if the value exists return that object so I can modify the other attributes on that object. The API is C#.

1 ACCEPTED ANSWER

Michael_Aleman2
Champ in-the-making
Champ in-the-making

There are a couple of methods you can use to solve this: FilterQuery and DynamicFilterQuery.

FilterQuery will use a configured Class Filter for you to perform a query.  Make sure you add the objectID attribute to the filter, so that you can access it in your FilterQueryResultsList.

DynamicFilterQuery allows one to define the query and return attributes, without the need of using an existing filter.

Keep in mind, that is is probably a good idea to "API_add a prefix or suffix to provide a visual to other admins NOT to alter the filter as it could break your code: this is a drawback of using a FilterQuery.

With either query, if you have results, you can access the Workview object using the objectID, create a value modifier and use your logic to determine which attributes need to be updated.

Both of these search methods are documented in the API SDK.  Search for "Executing Filter Queries" and that will bne a good place for you to start.

Good luck.

View answer in original post

2 REPLIES 2

Michael_Aleman2
Champ in-the-making
Champ in-the-making

There are a couple of methods you can use to solve this: FilterQuery and DynamicFilterQuery.

FilterQuery will use a configured Class Filter for you to perform a query.  Make sure you add the objectID attribute to the filter, so that you can access it in your FilterQueryResultsList.

DynamicFilterQuery allows one to define the query and return attributes, without the need of using an existing filter.

Keep in mind, that is is probably a good idea to "API_add a prefix or suffix to provide a visual to other admins NOT to alter the filter as it could break your code: this is a drawback of using a FilterQuery.

With either query, if you have results, you can access the Workview object using the objectID, create a value modifier and use your logic to determine which attributes need to be updated.

Both of these search methods are documented in the API SDK.  Search for "Executing Filter Queries" and that will bne a good place for you to start.

Good luck.

This is exactly what I needed. Thank you so much!