It looks like you're new here. Sign in or register to get started.
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) ;
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;
IF SeasonYear <> 0 THEN SETRANGE("Season Year",SeasonYear) ;
CASE SeasonYear OF SeasonYear::"2001": BEGIN END; SeasonYear::"2002": BEGIN END; etc. END;
CASE SeasonYear OF 0: (first value in the option-string) BEGIN END; 1: (second value in the option string) BEGIN END; etc. END;
Comments
How should we know what's wrong?
|To-Increase|
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;
http://www.BiloBeauty.com
http://www.autismspeaks.org
Wouldn't a field with Link to table "Date" or "Accounting Periods" would have done? How many years would you add to option field?
http://ssdynamics.co.in
and when i am checking with seasonyear<>0. it gives me error.
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 something
http://www.BiloBeauty.com
http://www.autismspeaks.org
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 this
(best practice)
or
(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.