Automatic key selection

AdministratorAdministrator Member, Moderator, Administrator Posts: 2,500
edited 2008-09-23 in Download section
Automatic key selection
Do you know users that search through a lot of records by setting filters without choosing the correct key? I do too! It's a bad experience for the user and it takes a lot of time and it reduce the overall performance of the Navision system.
So why not let the system automatically choose the best key each time the user set's a filter? The catch is that you need to make a few program lines on each form where you want to use this functionality.

A short description of what to do on each form is entered in the Documentation part of the object. The download also includes a txt file of the object. The object is created in a 3.70 environment. The "Best key" function it self is created by the master him selves: Preben Rasmussen - Thanks!

http://www.mibuso.com/dlinfo.asp?FileID=895

Discuss this download here.

Comments

  • PrebenRasmussenPrebenRasmussen Member Posts: 137
    Hey Anders ("Master of Disaster") :D

    As always you are 'using and tweaking' my code.... nice to see that the GetBestKeyNo was useful!

    Do keep up the great coding and submit more of your apps to mibuso.

    Sincerely
    "Navision Magician"
  • Soft_TodSoft_Tod Member Posts: 43
    This would be such a nice feature if the KeyReference.Index worked as it should for versions pre-4.03. Microsoft won't patch previous versions either :(

    The problem is that RecordRef.KEYCOUNT only returns the number of Active keys. The RecordRef.KEYINDEX correctly loops through all keys though, but only as many as RecordRef.KEYCOUNT reports.

    If any deactivated keys are present in between, the last active keys can't be reached.
      kr := rr.KEYINDEX(iKeyIdx);
      IF kr.ACTIVE THEN BEGIN
        FOR j := 1 TO kr.FIELDCOUNT DO BEGIN
          IF TEMPInt.GET(kr.FIELDINDEX(j).NUMBER) THEN BEGIN
             ;
          END;
        END;
      END ELSE BEGIN
        bInactiveKeys := TRUE;
        iNoOfInactive += 1;
      END;
    
    IF (bInactiveKeys) THEN
       MESSAGE('Deactivated Keys are present in this Table.\\' +
    //           'Due to a bug in MBS Navision, the number of deactivated keys equals ' +
    //           'the number of not reachable keys at the end of the list.\\' +
               'It is possible that a more suitable Key could exist!')
    
    It is impossible to make anything foolproof, because fools are so ingenious.
  • tejateja Member Posts: 78
    Hey Anders Pahuus,

    As i am new to navision, i was unable use this functionality.
    Please tell how and where to write new program lines.
  • ajhvdbajhvdb Member Posts: 672
    Soft Tod wrote:
    This would be such a nice feature if the KeyReference.Index worked as it should for versions pre-4.03. Microsoft won't patch previous versions either :(

    Thx for the info. Moving an inactive key to the last position was my solution. Doesn't rebuild anything.
Sign In or Register to comment.