Delphi Interface
Professional Edition


Installation

The Delphi interface consists of 8 files. The first 5 files are in the arulesxl\api\bin_redist directory. The last 3 files are in the arulesxl\api\delphi directory.

To use the Delphi interface you need to install the Arules component as follows:

  1. Open Delphi.
  2. Select from the menu 'Component/Install Component…'
  3. Select the 'Into existing package' tab which will by default install into the "Borland User Components" package in the file \borland\delphiN\Lib\dclusr.dpk.
  4. Press the button marked 'Browse' next to the 'Unit file name' box.
  5. Select ARulesXL\api\delphi\arules.pas
  6. Note the search path should now include arulesxl\api\delphi.
  7. Select 'OK' on the Install Component dialog box.
  8. Select 'Yes' on the 'Package dclusr.dpk will be rebuilt' confirmation box.
  9. Select 'OK' on the dialog box informing you that TLSARules has been added to the package.
  10. You should now see the ARulesXL mountain logo in the Additional components.

Then:

  1. Create a new project.
  2. Add ARulesXL\api\delphi\arulesxl.pas to your project.
  3. In the 'uses' section of your application add 'ARulesXL, Arules'.
  4. Put arulesrt.dll, ar_osutilsrt.lsx, ar_mysqlrt.lsx, arulesrt.xpl and arulesrt.cfg in the same directory as your application.

API Additions & Changes

QueryRulesToStringList

Description:

function QueryRulesToStringList(ruleset: string; query: string; answer: TStringList): boolean;

ruleset
The name of the ruleset
query
The query to run in the same format as is used for RQuery()
answer
The TStringList

Remarks:

Queries the named ruleset and returns the result as a list of strings.

Return Value:

The result of the query as a Delphi TStringList.

Returns false on failure.

Example:

QueryMoreToStringList

Description:

function QueryRulesToStringList(ruleset: string; query: string; answer: TStringList): boolean;

ruleset
The name of the ruleset
query
The query to run in the same format as is used for RQuery()
answer
The TStringList

Remarks:

Queries the named ruleset and returns the result as a list of strings. This call differs from QueryRulesToStringList() because any values that were found during prior queries are retained. This lets you query the same ruleset repeatedly gaining new information each time, instead of having to compute the values for all the objects each time.

Return Value:

The result of the query as a Delphi TStringList.

Returns false on failure.

Example:

LoadTableFromNameValueList

Description:

procedure LoadTableFromNameValueList(ruleset: string; objectname: string; col1name: string; col2name: string; nvlist: TStrings);

ruleset
The name of the ruleset
objectname
The name of the fact to load
col1name
The name of the 'name' column
col2name
The name of the 'value' column
nvlist
TStrings in Delphi name-value list format

Remarks:

Loads the specified fact in the specified ruleset with a list of names and values in a Delphi TStrings object. The TStrings object needs to use the Delphi NameValueSeparator to distinguish the 'name' and 'value' entries.

Return Value:

Throws an exception on failure.

Example:

Using the Amzi! Logic Server

The function GetLS() does not return a TLSEngine object as documented in the Amzi! Logic Server Reference Guide. Instead it returns a TLSARules object. This is so you can have both the Amzi! and ARulesXL Delphi components installed at the same time. Other than that, the Logic Server functions are identical.

Advice Sample

Building the Sample

First install the Delphi component as outlined above. Then:

  1. Open the 'Product Advice.xls' spreadsheet sample and select ARulesXL | Export from the main menu to export a file named 'advice.axl'.
  2. Copy advice.axl, arulesrt.dll, ar_osutilsrt.lsx, ar_mysqlrt.lsx, arulesrt.xpl and arulesrt.cfg to the advice sample directory.
  3. Build the project in the Delphi IDE.

Running the Sample

Run from the Delphi IDE. Enter a value for swing speed, and select other choices from the pull-down menus then press 'Query'.


Copyright ©2005-7 Amzi! inc. All Rights Reserved.
ARulesXL and Amzi! are trademarks or registered trademarks of Amzi!
Microsoft and Excel are trademarks or registered trademarks of Microsoft Corporation.