Solved

How to filter Get Request?

  • 9 November 2022
  • 9 replies
  • 460 views

Userlevel 5
Badge +14
  • Hero (Customer)
  • 275 replies

Hi,

I am trying to filter results with the query option. I tried many combinations but, I could not handle it. Get request gives an error. The error is "The types 'IfsApp.EmployeesHandling.EmploymentTypeState' and 'Edm.String' are not compatible.". How can I filter result?

 

 

 

The Error:

 

icon

Best answer by ChristianJ 9 November 2022, 20:54

View original

9 replies

Userlevel 2
Badge +5

Hi @hhy38,

 

You can try with:

/main/ifsapplications/projection/v1/EmployeesHandling.svc/Reference_LovEmploymentType?$filter=Objstate%20eq%20IfsApp.EmployeesHandling.EmploymentTypeState%27Active%27

 

Best Regards,

Christian

Userlevel 5
Badge +14

Thank you @ChristianJ,

It is working. What is the best practice to find  ‘IfsApp.EmployeesHandling.EmploymentTypeState’ part of filtering? 

 

Userlevel 7

Thank you @ChristianJ,

It is working. What is the best practice to find  ‘IfsApp.EmployeesHandling.EmploymentTypeState’ part of filtering? 

 

Easiest way is to apply the filter in the screen itself and then pick it up from the URL or Chrome Dev Tools. You can also look at the API from the API explorer, or use /main/ifsapplications/projection/v1/EmployeesHandling.svc/$openapi?V3 

 

EmploymentTypeState_Enumeration":{"type":"string","enum":["Active","Hidden","Blocked"]}

 

Userlevel 5
Badge +14

Thank you @anmise. I think I could not tell. Usually, we are using in the filter expression (coloumn eq ‘value’). When it comes to objstate it is different. You have to use the expression as (Objstate eq IfsApp.handling   state’state value’).  

 

 

To find this expression. I am using the first expression. Then, I am getting the error. Then I extract the ‘IfsApp.handling’ part to use the filter.

 

 

 
Userlevel 4
Badge +9

Hi guys,

I am having trouble to pass a state as parameter to my API, even when I use like you told. Follow the error message:

 

Thanks,

Gianni

Userlevel 5
Badge +14

Hi @gianni.neves,

 

Can you show your filter and the URL?

Userlevel 4
Badge +9

Hi @gianni.neves,

 

Can you show your filter and the URL?

Thanks for the quick answer

 

 

Userlevel 4
Badge +9

Hi @gianni.neves,

 

Can you show your filter and the URL?

Thanks for the quick answer

 

 

Thanks @hhy38, I found the solution.

Userlevel 5
Badge +14

@gianni.neves Very nice! You are welcome.

 

Reply