SeasonYear filtering filed is not working in itemledgerentry

monir_asianmonir_asian Member Posts: 80
edited 2012-03-30 in NAV Three Tier
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?

Comments

  • SogSog Member Posts: 1,023
    Bad customisation.
    How should we know what's wrong?
    |Pressing F1 is so much faster than opening your browser|
    |To-Increase|
  • monir_asianmonir_asian Member Posts: 80
    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;
  • SavatageSavatage Member Posts: 7,142
    It appear that you want to pick a year and have it filter.
    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) ;
    
  • ssinglassingla Member Posts: 2,973
    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.in
  • monir_asianmonir_asian Member Posts: 80
    this season year is a option field.

    and when i am checking with seasonyear<>0. it gives me error.
  • SavatageSavatage Member Posts: 7,142
    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 something
  • Torben_R.Torben_R. Member Posts: 99
    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 this
    CASE SeasonYear OF
      SeasonYear::"2001":
        BEGIN
        END;
      SeasonYear::"2002":
        BEGIN
        END;
      etc.
    END;
    
    (best practice)

    or
    CASE 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.
  • monir_asianmonir_asian Member Posts: 80
    thanks, it is working
Sign In or Register to comment.