Showing posts with label Navision. Show all posts
Showing posts with label Navision. Show all posts

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