cancel
Showing results for 
Search instead for 
Did you mean: 

How to filter on Is<something> properties through REST

RonaldSteiner
Collaborator II

Folks,

 

I am trying to get a list of all question fields in a questionnaire using the REST API (using the Archer Toolbox). When I query all properties returned by /api/core/system/fielddefinition/application, I see one called IsQuestion that seems to fit the bill to filter on. However, any filter I try using IsQuestion returns the error "Could not find a property named 'IsQuestion' on type 'ArcherTech.Common.Domain.FieldDefinition'." In fact, any of the Is<something> type properties return this error. 

 

Am I doing this incorrectly? My filter is: 

{
"Value": "?$orderby=Name&$filter=IsQuestion eq 1"
}

 

I've also tried false instead of 1. Same result.

 

If I filter on Name, the filter works, e.g.,

{
"Value": "?$orderby=Name&$filter=Name eq 'CT-01'"
}

Thanks,

Ron

1 ACCEPTED SOLUTION

Accepted Solutions

Jeff
Archer Employee
Archer Employee

Yes, the recommendation is to pull all field definitions for the application/level and filter the results. 

 

A defect was logged as ARCHER-66403 and was closed as functioning as designed.  Then a defect logged as ARCHER-67378 updated the documentation starting in 6.8.  If you open the Archer Help, search for "Metadata" and scroll down to very bottom to see a note.  

Metadata

Note: The following properties are allowed with the $filter, $select, and the $orderby actions in the OData query on the field definition resources available in the table above:

  • Id
  • LevelId
  • Type
  • Name
  • Alias
  • IsActive
  • Guid
  • ASOStatus
  • SystemType
  • IsPrivate
  • IsContentReadOnly
  • EsFieldMappingId
  • UpdateInformation
  • FieldMap

View solution in original post

5 REPLIES 5

Jeff
Archer Employee
Archer Employee

This occurs if the property is not assigned to all objects in the collection.  In these cases, you'll need to filter the results in the code after getting the collection from API.

DavidPetty
Archer Employee
Archer Employee

Filtering by field name does work:

ODATAFilter.png

Filtering the fields in the Control Standards application on 'Audience'

 Advisory Consultant - Archer, an RSA Business

I'm not quite sure I understand. Using one of my questionnaires, I query:

{
"Value": "?$orderby=Name&$filter=Name eq 'Attach Documentation'"
}

 

This gives me "IsQuestion": false; as one of the properties. However, then I try

{
"Value": "?$orderby=Name&$filter=Name eq 'Attach Documentation'&$select=Name,IsQuestion"
}

and it says that it could not find a property name 'IsQuestion'. 

 

Are you saying the only way to just pull the question fields is programmatically? In other words, get the results of the query on all fields in the module and then do some sort of 'IsQuestion eq True' filter on that? 

Jeff
Archer Employee
Archer Employee

Yes, the recommendation is to pull all field definitions for the application/level and filter the results. 

 

A defect was logged as ARCHER-66403 and was closed as functioning as designed.  Then a defect logged as ARCHER-67378 updated the documentation starting in 6.8.  If you open the Archer Help, search for "Metadata" and scroll down to very bottom to see a note.  

Metadata

Note: The following properties are allowed with the $filter, $select, and the $orderby actions in the OData query on the field definition resources available in the table above:

  • Id
  • LevelId
  • Type
  • Name
  • Alias
  • IsActive
  • Guid
  • ASOStatus
  • SystemType
  • IsPrivate
  • IsContentReadOnly
  • EsFieldMappingId
  • UpdateInformation
  • FieldMap

That really helps. Of course, it doesn't help that our Jurassic Archer (6.4 SP1 P1) doesn't have that extra note.