Wednesday, October 6, 2010

Navision and Delphi

In the BB.Db.Navision.X namespace there are a few dataset components to deal with Navision database, they are called:

  • TNavisionDatabase
  • TNavisionDataset
  • TNavisionObjectReplicator
  • TNavisionDataReplicator
With them is really easy to use all the features from Navision, they inherite from TDataset and TCustomConnection, making the use with Delphi very trivial, they are also fully integrated in the IDE, even some editors are included (like tableNo, TableName), of course one can insert, delete, modify records from the database...

Features from the help:

  - Companies Class
  - Tables Class
  - Users Connected
  - Message Queue
  - TClientDataSet compliance
  - Multithread TDataset descendant
  - Automatic Transaction detection
  - Read and Write directly through CFRONT.DLL
  - TNavision field descendants (FieldNumber, Relations, Size, Type)
  TNavisionBlobField
  TNavisionStringField
  TNavisionCodeField
  TNavisionOptionField
  TNavisionIntegerField
  TNavisionDecimalField
  TNavisionBooleanField
  TNavisionDateField
  TNavisionTimeField

  - FindField() (By number)
  - FieldByNumber() (Get a TField by Navision number)
  - New FieldTypes ftCode and ftOption
  - Renamed() (Automaticly modify all relations)
  - Navision Calculated fields (Automatic or not CalcFields)
  - FlowFilters
  - SumIndexFields (CalcSums)
  - Blob fields (Read and Write)
  - Cached Blob fields
  - Code fields (Uppercase fields)
  - Option fields (via Integer or String)
  - Lookup and Calculated fields
  - Bookmarks
  - Alpha Navision string support
  - BestKey()
  - TransferDataSet
  - TKey Class
  - TKeys Class
  - ENavisionException exception base class:
  ENavisionExceptionDuplicated
  ENavisionExceptionCalculated
  ENavisionExceptionInvalidOption
  ENavisionExceptionNotFound
  ENavisionExceptionInvalidKey
  ENavisionExceptionReadOnly
  ENavisionExceptionViolation
  - New Events:
  OnAfterGetRecord()
  OnRename()
  OnNavisionValidate() Called only by user
  - Test relations
  - Uses Closing Dates
  - Validate relations
  - Navision functions:
  TestField()
  CalcFields()
  SetRange()
  SetFilter()
  GetFilter()
  HasFilter()
  GetFilters()
  CopyFilters()
  CopyFilter()
  TransferFields() (By Number or Name)
  LockTable()
  DeleteAll()
  ModifyAll()
  CalcSums()
  CalcFields()
  Copy()
  Init()
  Get()
  Find()

Finally a simple example:


db: TNavisionDatabase;
ds: TNavisionDataSet;

db := TNavisionDatabase.Create(nil);
db.Server := 'SVNAV370';
db.Company := 'CRONUS';
db.User := 'DBA';
db.Password := 'XXX';
db.Path := 'c:\nav\0'; //directory with cfront.dll
db.Open;

ds := TNavisionDataSet.Create(nil);
ds.TableName := 'Country';
ds.Database := db;
ds.Open;

//Now ds can be connected with TDataSource therefore any visual
 Db control like TDBGrid, TDBCombox can show the data


4 comments:

  1. Althought this is an old post, could you please write more details? Or maybe a full example for download?
    Thanks

    ReplyDelete
  2. Ops, I should check more often the comments..., yes, I can send you a full download with real examples

    ReplyDelete
  3. Hi this looks really interesting - possibly doing some Navision integration soon so was very keen !
    Was trying to compile BB in Delphi 2010 looks like the code is maybe XE2 or 3 ?(Trect & Tpoint seem to be objects these days, amongst other things)
    Also BBE3D.Import._3DS is not found ?
    As I say it's the Navision stuff that really interests me though.
    Any thoughts
    Many thanks Harry Rogers



    Cheers

    ReplyDelete
  4. Harry, you should really use Navision*.pas files and forget about the rest, BTW I will check why that file it is missing, thanks and best regards

    ReplyDelete