Search on Integer value

ravi_navisionravi_navision Member Posts: 102
Hi Experts,

RandomNumber is a custom field and stores integer value.
How can I search on RandonNumber field.

Values in RandomNumber field
1000
1001
2001
1100

I want to search by 10* (field filter).Is it possible?

Result should be
1000
1001


Thanks,
ravi
~~ravi

Comments

  • DaveTDaveT Member Posts: 1,039
    Hi,

    Set the filter to 1000..1099 -will be a problem if you have 10000 as well.
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • ravi_navisionravi_navision Member Posts: 102
    Set the filter to 1000..1099 -will be a problem if you have 10000 as well



    Hi DaveT,

    Thanks for your response. Here I have pasted some values for example.
    Actually the data is
    1000
    1001
    10000
    10101
    1005
    1080
    …..etc
    ~~ravi
  • garakgarak Member Posts: 3,263
    The problem here is, that you use only Numbers in a Code field. so these field is a alphanumeric field with alpha numeric sort order. so, on SQL, not native (NAtive do it wrong) the integer sort is not "correct" (for alpha sort it is).
    So, to handle these problems fill the numbers before with 0000 (Null) or a letter like A0001000,A00010001,A00010002, etc

    If you can't Rename the Numbers, and you need the sort order only in a Report you can store the datas in a temporary table and run through this table in the report or fill a a separate field (like "No. 2") with 0000001,0001000, etc. To switch the order (integer sort) you select the key "No. 2"

    Regards
    Do you make it right, it works too!
  • ravi_navisionravi_navision Member Posts: 102
    Hi Garak,

    It is an integer field (not a code field). And I am trying to do a filter on the list form
    ~~ravi
  • kinekine Member Posts: 12,562
    May be best is to create new field of type code which will be filled in OnValidate of the integer field by the text representation of the integer. In this way you will be able to filter over this code field in a way you want...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • David_SingletonDavid_Singleton Member Posts: 5,479
    Hi Experts,

    RandomNumber is a custom field and stores integer value.
    How can I search on RandonNumber field.

    Values in RandomNumber field
    1000
    1001
    2001
    1100

    I want to search by 10* (field filter).Is it possible?

    Result should be
    1000
    1001


    Thanks,
    ravi

    The issue is conceptual not actual. You are confusing the word "integer" as a concept and "Integer" as a type of field. In your case you seem to be conceptualizing a code such as a telephone number (telephone number are not integers) with a true integer.

    You need to look at the design of your database and rethink it. Kamil's suggestion of creating a Code field in parallel is possibly the only "short term hack" available to you in this case. But better would be a conceptual rethink of what you are doing.
    David Singleton
  • ravi_navisionravi_navision Member Posts: 102
    Sorry David Singleton, if I confused you.

    Well, I hope Kine understood the issue better.

    Thanks to all
    ~~ravi
  • suvidhasuvidha Member Posts: 117
    Report level u can do something like this maybe!!!
    YourNos:
    1000
    1001
    10000
    10101
    1005
    1080
    …..etc

    OnAftergetrecord()
    EVALUATE(text1,YourNos));
    text2:=copystr(tex,1,2);
    if text2<>'10' then
    CurrReport.Skip;

    I don know how this will help thou!!!!
    Good luck
Sign In or Register to comment.