Options

How to know the current record number

nicolenicole Member Posts: 25
edited 2004-12-14 in Navision Attain
Please help. What function can I use to know the current record number?

Thanks!

Comments

  • Options
    NaviTools.comNaviTools.com Member Posts: 88
    Hi,

    There is no such function. Records are not numbered. You can identify any record with its primary key.

    If I understand you correctly, record number is 1 for first inserted records, 2 for second, ...

    Just for fun; If your answer is yes, you could get this by setting a filter on primary key with:

    TmpRec.SETRANGE( PKField, '', CurrentRecord.PKField )

    Then TmpRec.COUNT would give you record number of current record. But please don't do this :cry: This number will change if you insert or delete records.

    If I missunderstood you, could you explain what you want to achieve? Why do you need record number?
    http://www.NaviTools.com
    Documentation for Microsoft Navision
    E/R diagrams, Workflow diagrams, UML diagrams, process diagrams
  • Options
    kinekine Member Posts: 12,562
    If you want it for something as "you are on xxx record from yyyy" it is not possible to made it without impact to performance in DB systems. It is why the scrollbar on table is not showing "real" position and proportions to table size. Only after you go through whole table it is ok - because to know, where you are, you must go through the records and count.... and it is big data flow...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    PrebenRasmussenPrebenRasmussen Member Posts: 137
    I created a very small example to show you how this is done. It is almost without performance impact, but requires table changes.
    This will be uploaded to the site named something like "CurrentIndex.fob".

    It is a very small example created in a few minutes, so I hope you understand the functionality.
  • Options
    NaviTools.comNaviTools.com Member Posts: 88
    Are you looking for unique RowID like other SQL databases have?
    http://www.NaviTools.com
    Documentation for Microsoft Navision
    E/R diagrams, Workflow diagrams, UML diagrams, process diagrams
  • Options
    RobertMoRobertMo Member Posts: 484
    We have all gone through a challenge to program this "Access" feature. If it is a small code, maybe you can copy/paste it here? Or at least the idea?
               ®obi           
    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  • Options
    PrebenRasmussenPrebenRasmussen Member Posts: 137
    The example was uploaded seconds after my note above was written, so please have patience. Maybe mr. Van Dyck is on weekend...
  • Options
    Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    Actually, I went to Aachen (Germany) to do some Christmas shopping. \:D/
    The sample is available for download now.
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • Options
    PrebenRasmussenPrebenRasmussen Member Posts: 137
    Now 148 downloads and no comments! Did nobody manage to get it working, or isn't it understandable?
  • Options
    PrebenRasmussenPrebenRasmussen Member Posts: 137
    Now 210 downloads and still no comments! :?:
  • Options
    NaviTools.comNaviTools.com Member Posts: 88
    Hi PrebenRasmussen,

    I looked at your code for the second time.

    You could add some comments, but that would be against Navision Coding Standards :wink:

    I think this code works well if you are just adding records. When you insert them RecordCount would not have sequential number?

    Have you noticed, that Nicole never replied to everything writen in this topic? We might be missing her true requirements. Nicole, where are you?
    http://www.NaviTools.com
    Documentation for Microsoft Navision
    E/R diagrams, Workflow diagrams, UML diagrams, process diagrams
Sign In or Register to comment.