SeasonYear filtering filed is not working in itemledgerentry

monir_asian
Member Posts: 80
filtering field is not working for seasonyear and document no field on itemledger entry table.
but it is working from textbox field on option form .
what is the problem?
but it is working from textbox field on option form .
what is the problem?
0
Comments
-
Bad customisation.
How should we know what's wrong?0 -
IF (FORMAT( SeasonYear)<>'') THEN BEGIN
CASE SeasonYear OF
2001: BEGIN
"Item Ledger Entry".SETRANGE("Item Ledger Entry"."Season Year",2001) ;
END;
2002: BEGIN
"Item Ledger Entry".SETRANGE("Item Ledger Entry"."Season Year",2002) ;
END;
2003: BEGIN
"Item Ledger Entry".SETRANGE("Item Ledger Entry"."Season Year",2003) ;
END;
2004: BEGIN
"Item Ledger Entry".SETRANGE("Item Ledger Entry"."Season Year",2004) ;
END;
2005: BEGIN
"Item Ledger Entry".SETRANGE("Item Ledger Entry"."Season Year",2005) ;
END;
2006: BEGIN
"Item Ledger Entry".SETRANGE("Item Ledger Entry"."Season Year",2006) ;
END;
2007: BEGIN
"Item Ledger Entry".SETRANGE("Item Ledger Entry"."Season Year",2007) ;
END;
2008: BEGIN
"Item Ledger Entry".SETRANGE("Item Ledger Entry"."Season Year",2008) ;
END;
2009: BEGIN
"Item Ledger Entry".SETRANGE("Item Ledger Entry"."Season Year",2009) ;
END;
2010: BEGIN
"Item Ledger Entry".SETRANGE("Item Ledger Entry"."Season Year",2010) ;
END;
2011: BEGIN
"Item Ledger Entry".SETRANGE("Item Ledger Entry"."Season Year",2011) ;
END;
2012: BEGIN
"Item Ledger Entry".SETRANGE("Item Ledger Entry"."Season Year",2012) ;
END;
2013: BEGIN
"Item Ledger Entry".SETRANGE("Item Ledger Entry"."Season Year",2013) ;
END;
2014: BEGIN
"Item Ledger Entry".SETRANGE("Item Ledger Entry"."Season Year",2014) ;
END;
2015: BEGIN
"Item Ledger Entry".SETRANGE("Item Ledger Entry"."Season Year",2015) ;
END;
2016: BEGIN
"Item Ledger Entry".SETRANGE("Item Ledger Entry"."Season Year",2016) ;
END;
2017: BEGIN
"Item Ledger Entry".SETRANGE("Item Ledger Entry"."Season Year",2017) ;
END;
2018: BEGIN
"Item Ledger Entry".SETRANGE("Item Ledger Entry"."Season Year",2018) ;
END;
2019: BEGIN
"Item Ledger Entry".SETRANGE("Item Ledger Entry"."Season Year",2019) ;
END;
2020: BEGIN
"Item Ledger Entry".SETRANGE("Item Ledger Entry"."Season Year",2020) ;
END;
END;
END;0 -
It appear that you want to pick a year and have it filter.mohana_cse06 wrote:why do you need all this code?
IF (FORMAT( SeasonYear)<>'') THEN BEGIN CASE SeasonYear OF 2001: BEGIN SETRANGE("Season Year",2001) ; END; 2002: BEGIN SETRANGE("Season Year",2002) ; END; 2003: BEGIN SETRANGE("Season Year",2003) ; END; 2004: BEGIN SETRANGE("Season Year",2004) ; END; 2005: BEGIN SETRANGE("Season Year",2005) ; END; 2006: BEGIN SETRANGE("Season Year",2006) ; END; 2007: BEGIN SETRANGE("Season Year",2007) ; END; 2008: BEGIN SETRANGE("Season Year",2008) ; END; 2009: BEGIN SETRANGE("Season Year",2009) ; END; 2010: BEGIN SETRANGE("Season Year",2010) ; END; 2011: BEGIN SETRANGE("Season Year",2011) ; END; 2012: BEGIN SETRANGE("Season Year",2012) ; END; 2013: BEGIN SETRANGE("Season Year",2013) ; END; 2014: BEGIN SETRANGE("Season Year",2014) ; END; 2015: BEGIN SETRANGE("Season Year",2015) ; END; 2016: BEGIN SETRANGE("Season Year",2016) ; END; 2017: BEGIN SETRANGE("Season Year",2017) ; END; 2018: BEGIN SETRANGE("Season Year",2018) ; END; 2019: BEGIN SETRANGE("Season Year",2019) ; END; 2020: BEGIN SETRANGE("Season Year",2020) ; END; END; END;
Can it be simply?IF SeasonYear <> 0 THEN SETRANGE("Season Year",SeasonYear) ;
0 -
Can you tell the "Data Type" of the field SeasonYear in Item Ledger Entry table?
Wouldn't a field with Link to table "Date" or "Accounting Periods" would have done? How many years would you add to option field?CA Sandeep Singla
http://ssdynamics.co.in0 -
this season year is a option field.
and when i am checking with seasonyear<>0. it gives me error.0 -
Always post what the error says - thanks
You have to ask yourself why would you even use a code like seasonyear<>0
everyseason has a year so what's the point of it?
and option formats are different
try
if SeasonYear = SeasonYear::2012 then do something0 -
Numbers in an option-field is a bad idea.
An Optionstring like 2001,2002,2003,2004.... is more difficult to use in coding.
In code
SeasonYear::2002:
is converted to the 2002nd value in the option-string.
You have to code it like thisCASE SeasonYear OF SeasonYear::"2001": BEGIN END; SeasonYear::"2002": BEGIN END; etc. END;
(best practice)
orCASE SeasonYear OF 0: (first value in the option-string) BEGIN END; 1: (second value in the option string) BEGIN END; etc. END;
(not good practice - but it works)
Normally I would create the option-string like Y2001,Y2002,Y2003 etc. and use 2001,2002,2003 etc. in the option-cation.0 -
thanks, it is working0
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