cancel
Showing results for 
Search instead for 
Did you mean: 

How to use filter with

Former Member
0 Kudos

Hi to all,

I have created OData service endpoint, using the below linked approach,

I got Odata service and am able to list all the data from database.

Now,

I want to list the record based on some conditions like where  Name1 = "test"

Pls help me on this ....

FYI.,

am sharing the data format which I am getting from that Service,

http://localhost:8080/Customer_Reg/custlist.svc/CustGeneralDatas()/?$format=json

Output:

{"d":{"results":[{"__metadata":{"id":"http://localhost:8080/Customer_Reg/custlist.svc/CustGeneralDatas('1')","uri":"http://localhost:8080/Customer_Reg/custlist.svc/CustGeneralDatas('1')","type":"Customer_Reg.CustGeneralData"},"Aenam":null,"Anred":"2","Cin":null,"City1":"delhi","City2":"98","Ernam":null,"Ersda":null,"Kunnr":"1","Laeda":null,"Land1":null,"Mcod1":"3","Name1":"mahie","Name2":"5","Panno":null,"PoBox":"6","Pstlz":"9","Regio":null,"Smtp_addr":"mahi@gmail.vom","StrSuppl1":"7","StrSuppl2":"7","Stras":"6","TelNumber":"9738285552","Telf1":null,"Telfx":null,"Telx1":null,"Tin":null},

{"__metadata":{"id":"http://localhost:8080/Customer_Reg/custlist.svc/CustGeneralDatas('2')","uri":"http://localhost:8080/Customer_Reg/custlist.svc/CustGeneralDatas('2')","type":"Customer_Reg.CustGeneralData"},"Aenam":null,"Anred":"7","Cin":null,"City1":"bangalore","City2":null,"Ernam":null,"Ersda":null,"Kunnr":"2","Laeda":null,"Land1":null,"Mcod1":"7","Name1":"itenz","Name2":"8","Panno":null,"PoBox":"09","Pstlz":null,"Regio":null,"Smtp_addr":"test@ted.com","StrSuppl1":"0","StrSuppl2":"0","Stras":"9","TelNumber":"0989745984","Telf1":null,"Telfx":null,"Telx1":null,"Tin":null},

{"__metadata":{"id":"http://localhost:8080/Customer_Reg/custlist.svc/CustGeneralDatas('6')","uri":"http://localhost:8080/Customer_Reg/custlist.svc/CustGeneralDatas('6')","type":"Customer_Reg.CustGeneralData"},"Aenam":null,"Anred":"tf","Cin":null,"City1":"test","City2":null,"Ernam":null,"Ersda":null,"Kunnr":"6","Laeda":null,"Land1":null,"Mcod1":"test","Name1":"test","Name2":"test","Panno":null,"PoBox":"test","Pstlz":null,"Regio":null,"Smtp_addr":"test","StrSuppl1":"test","StrSuppl2":"test","Stras":"test","TelNumber":"test","Telf1":null,"Telfx":null,"Telx1":null,"Tin":null}]}}

Tags edited by: Jitendra Kansal (Moderator)

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi to all,

I found the issue & it's fixed.

Issue was required library files were missing in Dynamic web-project.

Thanks to all....

Regards,

Mahendran

Answers (2)

Answers (2)

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

You can set filterable attribute for the properties Name1 as per this guide.

http://localhost:8080/Customer_Reg/custlist.svc/CustGeneralDatas?$filter=Name1 eq 'test'



You can also implement READ operation as per


Where URI would be called like: http://localhost:8080/Customer_Reg/custlist.svc/CustGeneralDatas('1')


Regards,

JK

Former Member
0 Kudos

Hi JK,

Thanks for the reply,

Here I created Odata service by referring the following link,

for the below request, am getting error like

HTTP Status 500 -

http://localhost:8080/Customer_Reg/custlist.svc/CustGeneralDatas?$filter=Name1%20eq%20%27test%27

FYI.,

I attached the error file

Regards,

Mahi

kammaje_cis
Active Contributor
0 Kudos

Mahendran,

$filter is what you are looking for. Search  OData + $filter to get the URL conventions.

Thanks

Krishna