Nav 5.1 Setrange Error
Morilen
Member Posts: 30
I am attempting to add another SETRANGE parameter when data is pulled from the Customer Equipment (custom) table.
CustEquip is set as a record under Global Variables for that table. 'New' is one of the options you can choose when entering data into the "Asset Status" field. I have several records that already exist with this value and simply want it to only take values of 'New' and ignore values of 'Deactivated'. The rest of the code works perfectly and I only get the error below when I add in the Bold line.
Any help would be greatly appreciated.

MajortotalQty := 0;
MinorQty := 0;
CustEquip.RESET;
CustEquip.SETRANGE("Customer No.","Sales Header"."Sell-to Customer No.");
CustEquip.SETRANGE(Type,1);
CustEquip.SETRANGE("Item No.",'Q1002');
//custequip.setrange(Quantity,0);
IF CustEquip.FIND('-') THEN
MinorQty := CustEquip.COUNT;
CustEquip.RESET;
CustEquip.SETRANGE("Customer No.","Sales Header"."Sell-to Customer No.");
CustEquip.SETRANGE(Type,0);
CustEquip.SETRANGE("Item No.",'Q1002');
CustEquip.SETRANGE("Asset Status", 'New');
IF CustEquip.FIND('-') THEN
REPEAT
CustEquip.CALCFIELDS(Quantity);
MajortotalQty := MajortotalQty + CustEquip.Quantity;
UNTIL CustEquip.NEXT = 0;
Error
Type conversion is not possible because 1 of the operators contains an invalid type.
Option := Text
CustEquip is set as a record under Global Variables for that table. 'New' is one of the options you can choose when entering data into the "Asset Status" field. I have several records that already exist with this value and simply want it to only take values of 'New' and ignore values of 'Deactivated'. The rest of the code works perfectly and I only get the error below when I add in the Bold line.
Any help would be greatly appreciated.
MajortotalQty := 0;
MinorQty := 0;
CustEquip.RESET;
CustEquip.SETRANGE("Customer No.","Sales Header"."Sell-to Customer No.");
CustEquip.SETRANGE(Type,1);
CustEquip.SETRANGE("Item No.",'Q1002');
//custequip.setrange(Quantity,0);
IF CustEquip.FIND('-') THEN
MinorQty := CustEquip.COUNT;
CustEquip.RESET;
CustEquip.SETRANGE("Customer No.","Sales Header"."Sell-to Customer No.");
CustEquip.SETRANGE(Type,0);
CustEquip.SETRANGE("Item No.",'Q1002');
CustEquip.SETRANGE("Asset Status", 'New');
IF CustEquip.FIND('-') THEN
REPEAT
CustEquip.CALCFIELDS(Quantity);
MajortotalQty := MajortotalQty + CustEquip.Quantity;
UNTIL CustEquip.NEXT = 0;
Error
Type conversion is not possible because 1 of the operators contains an invalid type.
Option := Text
0
Comments
-
CustEquip.SETRANGE("Asset Status",CustEquip."Asset Status"::New);Internally, option type fields are stored as an integer. In C/AL code, Option type fields are enumerated by ::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
- 322 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
