Web Services - Filter on a boolean field

ryancairns
Member Posts: 40
Hi,
I am trying to create a very simple web service and I would like to filter on a boolean field "Active" before calling ReadMultiple. This keeps generating a SoapException: Id 0 was not found in Item object!
Any help would be greatly appreciated - thanks!
//Create a filter
List<PLU_Filter> plufilter = new List<PLU_Filter>();
//Filter on the NAV field - No
PLU_Filter noFilter = new PLU_Filter();
noFilter.Field = PLU_Fields.No;
noFilter.Criteria = "C*";
plufilter.Add(noFilter);
//You can setup multiple filters/search criteria
//Filter on the NAV field - Active
PLU_Filter activeFilter = new PLU_Filter();
activeFilter.Field = PLU_Fields.Active;
activeFilter.Criteria = "True";
plufilter.Add(activeFilter);
//Read the list into an array
PLU[] pluitemlist = pluservice.ReadMultiple(plufilter.ToArray(), null, 100);
I am trying to create a very simple web service and I would like to filter on a boolean field "Active" before calling ReadMultiple. This keeps generating a SoapException: Id 0 was not found in Item object!
Any help would be greatly appreciated - thanks!
//Create a filter
List<PLU_Filter> plufilter = new List<PLU_Filter>();
//Filter on the NAV field - No
PLU_Filter noFilter = new PLU_Filter();
noFilter.Field = PLU_Fields.No;
noFilter.Criteria = "C*";
plufilter.Add(noFilter);
//You can setup multiple filters/search criteria
//Filter on the NAV field - Active
PLU_Filter activeFilter = new PLU_Filter();
activeFilter.Field = PLU_Fields.Active;
activeFilter.Criteria = "True";
plufilter.Add(activeFilter);
//Read the list into an array
PLU[] pluitemlist = pluservice.ReadMultiple(plufilter.ToArray(), null, 100);
0
Comments
-
Sorry to bump this - but I really thought someone would know the answer to this. If anyone is able to help it would be greatly appreciated. Many thanks, Ryan0
-
I've encountered the same behavior if you try to set the filter on a variable instead of a field in the table. Might this be your case?0
-
I have the same problem trying to filter a variable instead of a field. Any ideas how to solve it?0
-
This is a example of the filter applied on the BOOLEAN field:
// collection of the filters List<ContactQuestions_Filter> filters = new List<ContactQuestions_Filter>(); // definition of a filter ContactQuestions_Filter filter = new ContactQuestions_Filter(); filter.Field = ContactQuestions_Fields.Multiple_Answers; filter.Criteria = "1"; // add the filter to the collection filters.Add(filter); // first two fields are additional custom parameters and practically do not affect // the functionality of the standard filters return ClientWs.ReadMultiple(contactNo, _CenterNo, filters.ToArray(), null, 0);
There is everything all right in my case...0 -
What about filtering a field that isn't part of the table. I want to filter the Job table by Customer Name, but that field doesn't exists in the table. I create a variable and fill it in the OnAfterGetRecord trigger. When I filter that field with the "filter.Field" and "filter.Criteria", i get the SoapException "Id 0 was not found in Job objetct!". Is there a way to do that without creating the field in the table?0
-
Goyo wrote:What about filtering a field that isn't part of the table. I want to filter the Job table by Customer Name, but that field doesn't exists in the table. I create a variable and fill it in the OnAfterGetRecord trigger. When I filter that field with the "filter.Field" and "filter.Criteria", i get the SoapException "Id 0 was not found in Job objetct!". Is there a way to do that without creating the field in the table?0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions