Display items where length, width, or height is 0 in UOM tbl

johnsogj
Member Posts: 103
Hello, I'm trying to create a report displays all items where on hand quantity is greater than 0 (in the item card) AND where either length, width, or height in the UOM table is "0". I'm having trouble. can anyone help me with this code?
thanks
thanks
0
Comments
-
Only way i'd see to do this ( next to going through all records and MARK-ing them, which is WAY slow ) is to add a field with length+height+width ( and the appropriate code to fill it, of course ). Then filtering that field on <> 0 would work0
-
You can't filter the Item table for this purpose, and you also don't have to add any fields. Create a report off of the Item table, and write some code in the OnAfterGetRecord table to loop through the Item UOM records related to the Item, and do CurrReport.SKIP if none of those fields is 0.
I don't know whether filtering the Inventory field is faster than calculating inventory in the same trigger, you'd have to try that out.0 -
something like this? It isnt working.... any ideas?
UOMTable.SETCURRENTKEY("Item No.", "Length", "Width", "Height");
UOMTable.SETRANGE("Item No.",Item."No.");
IF "length">0 THEN
CurrReport.SKIP
ELSE BEGIN
length := UOMTable.Length
END;;0 -
Hi,
Create your report off the item table. In the on aftergetrecord trigger putif ItemUOM.get( "No.", "Base unit of measure code" ) then // Assuming you want to test the base UOM if ( itemUOM.Length <> 0 ) and ( itemUOM.Width <> 0 ) and ( itemUOM.Height <> 0 ) then currreport.skip;
Of Course set the filter for the item.inventory > 00 -
In OnAfterGetRecord of an Item dataitem, something like this:
Item.CALCFIELD(Inventory); IF Item.Inventory = 0 THEN CurrReport.SKIP; ItemUOM.RESET; ItemUOM.SETRANGE("Item No.",Item."No.") IF ItemUOM.FINDSET(FALSE,FALSE) THEN BEGIN FoundOne := FALSE; //FoundOne is a boolean variable REPEAT IF (ItemUOM.Length = 0) OR (ItemUOM.Width = 0) OR (ItemUOM.Height = 0) THEN FoundOne := TRUE; UNTIL (ItemUOM.NEXT = 0) OR (FoundOne = TRUE); IF NOT FoundOne THEN CurrReport.SKIP; END ELSE BEGIN CurrReport.SKIP; END;
I haven't tried any of this, so I might have my TRUE and FALSE mixed up0 -
wow! that was perfect. I had to make a few syntax tweaks, but it worked. I will surely be able to model it in future reports. thanks for your help.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