CAPITAL Connector

CAPITAL Connecter - OLE Server

This reference guide is copyright (C) 2008 William Nitschke.

Documentation by William Nitschke.

Programming by William Nitschke and Andrew Wos.

The CAPITAL program is copyright (C) 1987-2008 by William Nitschke.

Manufactured & Distributed by CAPITAL Office Business Software.

All Rights Reserved

Fast Start

Installing The Connecter Class

Establishing A Connection

Object Methods

Executing CBS Remotely

Unsupported CBS Function List

Contact Details

You can contact CAPITAL Office Business Software in a variety of ways for technical support and sales inquiries. These include:

Fax

Dial: 61 2 8004 8264 - This is a good way to contact us for support as you may want to include technical information along with your inquiry.

E-Mail

developmentt@capitaloffice.com.au

sales@capitaloffice.com.au

Similar to fax and often faster.

Voice

Technical Consulting: 61 2 9311 1222

General helpdesk support: 1300 734 099

Mail

Please mail letters and packages to our mail address:

CAPITAL Office Business Software

PO Box 341

MAROUBRA JUNCTION

NSW 2035

SYDNEY AUSTRALIA

Web Site

You can also obtain information from our web site: www.capitaloffice.com.au

If you intend contacting us for technical assistance, please review the topic: Getting Help first.

Copyright

This reference guide is copyright (C) 1985-2008 William Nitschke.

Documentation by William Nitschke.

Programming by William Nitschke and Andrew Wos.

The CAPITAL program is copyright (C) 1987-2008 by William Nitschke.

Manufactured & Distributed by CAPITAL Office Business Software.

CAPITAL Visual Builder is (c) 1987-2008 by William Nitschke, for CAPITAL Office Business Software.

Visit our web site at: www.capitaloffice.com.au . Support Forum: www.capitaloffice.com.au/forum


Licence Agreement

CAPITAL OFFICE BUSINESS SOFTWARE LICENCE AGREEMENT WITH LIMITED WARRANTY

This a legal document and is an agreement between you, the end user, and Capital Office Business Software. By operating this software you are agreeing to become bound by the terms of this Agreement, which includes the SOFTWARE LICENCE, WARRANTY and ACKNOWLEDGEMENT.

IF YOU DO NOT AGREE TO THE TERMS OF THIS AGREEMENT, DO NOT OPEN THE SEALED DISK PACKAGE AND DO NOT OPERATE THE SOFTWARE. Promptly return the unopened disk package and the other items (including written materials) which are part of this product to the place where you obtained them for a full refund.

In order to preserve and protect its right under applicable laws, Capital Office Business Software does not sell rights in Capital Office Business Software SOFTWARE. Rather, Capital Office Business Software grants the right to use Capital Office Business Software SOFTWARE by means of a SOFTWARE LICENCE. Capital Office Business Software specifically retains title to all Capital Office Business Software computer software.

CAPITAL OFFICE BUSINESS SOFTWARE LICENCE.

1. GRANT OF LICENCE. In consideration of payment of the LICENCE fee which is part of the price you paid for this product, and your agreement to abide by the terms and conditions of this Licence and the Warranty, Capital Office Business Software, as Licensor, grants to you, the LICENSEE, a non-exclusive right to use and display this copy of a Capital Office Business Software software program (hereinafter the "SOFTWARE") on a single COMPUTER (i.e., with a single CPU) at a single location or on a single network of interconnected computers at a single location only so long as you comply with the terms of this Licence. Capital Office Business Software reserves all rights not expressly granted to LICENSEE.

2. OWNERSHIP OF SOFTWARE. As the LICENSEE, you do not own the written materials enclosed or magnetic or other physical media on which the SOFTWARE is originally or subsequently recorded or fixed, but an express condition of this License is that Capital Office Business Software retains title and ownership of the written materials, original disk and the SOFTWARE recorded thereon as well as all subsequent copies of the SOFTWARE, regardless of the form or media in or on which the original and other copies may exist. This Licence is not a sale of the original SOFTWARE or any copy.

3. COPY RESTRICTIONS. This SOFTWARE and the accompanying written materials are the subject of copyright. Unauthorized copying of the SOFTWARE is expressly forbidden. You may make one (1) copy of the SOFTWARE solely for backup purposes.

4. TERMINATION. This Licence is effective until terminated. This Licence will automatically terminate without notice from Capital Office Business Software if you fail to comply with any provision of this Licence. Upon termination you shall destroy the written materials and all copies of the SOFTWARE.

LIMITED WARRANTY.

This Agreement is governed by the laws of the State of NSW and shall benefit Capital Office Business Software, its successors and assigns. LICENSEE consents to jurisdiction in the state and federal courts located in the state of NSW.

(a) If within ninety (90) days from the date if delivery of the SOFTWARE as evidenced by the copy of the dealer receipt LICENSEE notifies Capital Office Business Software of a defect on the SOFTWARE (not caused by use, abuse, accident or misapplication) Capital Office Business Software shall at its discretion either

(i) return the purchase price; or

(ii) replace the SOFTWARE

In the event of replacement of the SOFTWARE the replacement will be warranted for the remainder of the original warranty period of thirty (30) days whichever is longer.

(b) To the full extent permitted by the State or Territory law or laws applicable to this Agreement, any condition or warranties imposed by such legislation are hereby excluded. Insofar as liability under or pursuant to any legislation whether of State, Territory or Commonwealth, may not be excluded, such liability is limited to:

(i) replacement of the SOFTWARE

(ii) correction of defects in the SOFTWARE at the

exclusive option of Capital Office Business Software.

(c) The LICENSEE acknowledges that no promise, representation or warranty or undertaking has been made or given by Capital Office Business Software or any person or company on its behalf in relation to the profitability of or any other consequences or benefits to be obtained from the delivery or use of the SOFTWARE and any accompanying written materials or as to its merchantability or fitness for any purpose or purposes and LICENSEE has relied upon LICENSEE's own skill and judgement deciding to acquire the SOFTWARE and any accompanying written materials for use by LICENSEE. This Agreement constitutes the entire agreement and understanding between the parties in relation to the supply of SOFTWARE and any accompanying written materials to the LICENSEE.

(d) Except as and to the extend that is hereinbefore provided, under no circumstances shall Capital Office Business Software or any related company be liable for any loss, damage or injury (including without limitation any loss of profit indirect, consequential or incidental loss, damage or injury) arising from the supply or use of the SOFTWARE and any accompanying written materials or any failure by Capital Office Business Software to perform an obligation or observe any terms of this Agreement.

Should you have any questions concerning this Agreement or this Limited Warranty please contact in writing: Capital Office Business Software, P.O. Box 341, Maroubra Junction, NSW 2035, AUSTRALIA.


Establishing A Connection

The examples in this reference manual use Visual Basic for Applications.

To test whether the CAPITAL COM Server has been successfully installed, execute these instructions:

Sub CapitalConnector()

Dim capital As Object

Set capital = CreateObject("CapitalOfficeClass")

capital.Echo "Hello World!"

End Sub

The following messagebox should be displayed:

To establish a connection with a CAPITAL database you must use the ConnectPath() and OpenCompany() method calls. Then open whatever tables you require for querying the system.

Sub CapitalConnector()

Dim capital As Object

Set capital = CreateObject("CapitalOfficeClass")

capital.ConnectPath ("c:\capital")

capital.OpenCompany ("sample")

End Sub

This example establishes a connection and opens various tables required in order to use the SpecialPrice() method. It returns the first special price found in the system for the customer account AAA.

Sub CapitalConnector()

Dim capital As Object

Set capital = CreateObject("CapitalOfficeClass")

capital.ConnectPath ("c:\capital")

capital.OpenCompany ("sample")

capital.OpenTable ("custrec")

capital.OpenTable ("stock")

capital.OpenTable ("matrix")

capital.OpenTable ("type")

capital.OpenTable ("invoice")

MsgBox (capital.SpecialPrice("AAA"))

End Sub

____________________________

Related Topics:

ConnectPath()

OpenCompany()


Executing CBS Remotely

The CAPITAL Connector can remotely execute most CAPITAL Business Script (CBS) statements and functions. For the list of unsupported CBS functions consult the topic: Unsupported CBS Functions List.

Script functions relating to GUI interaction are not supported with the exception of Echo(), which is included for testing purposes. Most complex functions such as those relating to ZIP compression of files and sending emails, are presently not supported.

To execute a CBS script remotely call the ScriptRun() method.

Example

Sub CapitalConnector()

Dim capital As Object

Set capital = CreateObject("CapitalOfficeClass")

capital.ConnectPath ("c:\capital")

capital.OpenCompany ("sample")

Rem display return result in messagebox

MsgBox (capital.ScriptRun("c:\capital\MyScript.mac"))

End Sub


Installing The Connecter Class

Installing The CAPITAL Connector Class

1. Run the program SETUPConnector.exe

2. Specify where the connector software should be installed. This can be the \CAPITAL folder or some other location. Wherever the software may be installed, it must be possible for the connector software to be able to access the \CAPITAL folder, through either a drive letter mapping or URL.

If you are operating the Corporate Edition of CAPITAL Office, the connector software must be installed on a drive that has CAPITAL's Server Software (Advantage Database Server) installed.

3. After installing the software click on Windows Start|Run and type:

regsvr32 X:\XXX\CapitalOfficeClass.DLL

where X:\XXX is the path where you have installed the connector software. This step is required to register the connector software as a COM server on the computer that will be accessing the connector.

You will not be able to register the COM server if you specify the wrong path.

Corporate Edition

When operating the CAPITAL Connector with the Corporate Edition of CAPITAL Office, ensure that the ADS DLL files are located in the same file location as CapitalOfficeClass.DLL. These include the files ACE32.DLL and AXCWS32.DLL.


Object Methods

method | Type | Comment
ConnectPath() | Connection | Call first to establish a database connection.
OpenCompany() | Connection | Call second to access the company to process.
Close Company() | Connection | Closes all open company database tables.
AddRecord() | Database |
CompressTable() | Database |
CloseIndex() | Database |
CloseTable() | Database |
CreateTable() | Database |
DeleteRecord() | Database |
EndOfTable() | Database |
FilterTable() | Database |
Find() | Database | Use to locate record data.
Goto() | Database |
GotoTop() | Database |
GotoBottom() | Database |
IndexTable() | Database |
IsOpenTable() | Database |
LockRecord() | Database | Records must be locked before they can be written to.
OpenTable() | Database | Tables must be opened before their contents can be accessed.
OrderTable() | Database |
RecordNo() | Database |
Read() | Database | Used to read the field contents from a table.
Skip() | Database | Used to navigate through table one row or record at a time.
UnlockRecord() | Database |
Write() | Database | Used to write data into a record/row.
IsPaid() | Query |
IsPayment() | Query |
SpecialName() | Query |
SpecialPrice() | Query |
StockID() | Query |
Today() | Query |
TranInfo() | Query |
StockPrice() | Query |
StockDescription() | Query |
StockMovement() | Query |
Unpaid() | Query |
ScriptRun() | Special Purpose | Execute CAPITAL scripts remotely.
Echo() | Testing |
Version() | Version |
TranStr() | String | Convert transaction numbers to formatted strings.
ErrorCode() | Diagnostic | Determine if an error/problem occurred.
ErrorSubCode() | Diagnostic |
ErrorMessage() | Diagnostic | Descriptive text relating to the error code.


Table Navigation

Once a table has been opened using the OpenTable() method it can be searched using the Find() method and stepped through one row/record at a time using the Skip() method.

The following Visual Basic for Applications code opens the table Stock, and based on user prompting, writes the name and description of the next 100 records (if that many are found) into an Excel spreadsheet.

The Read() method is used to retrieve field information from each record in turn. The Read() method requires two parameters. The name of the field to retrieve and which table to retrieve the field from.

If the Skip() operation fails, because there are no more records to move to, it will return a boolean False value.

Sub CapitalConnector()

Dim capital As Object

Dim Name As String

Dim Description As String

Dim CodeToFind As String

Set capital = CreateObject("CapitalOfficeClass")

capital.ConnectPath ("c:\capital")

capital.OpenCompany ("sample")

Rem Open required tables

capital.OpenTable ("Stock")

CodeToFind = InputBox("Enter the product code to find. This and the next 100 closest items will be placed in the spreadsheet.")

If Not capital.Find(UCase(CodeToFind), "Stock", , True) Then

MsgBox ("No match found")

GoTo Finished

End If

Range("A1").Select

For i = 1 To 100

Name = capital.Read("Name", "Stock")

Description = capital.Read("Title", "Stock")

ActiveCell.Value = Name

ActiveCell.Offset(0, 1).Activate

ActiveCell.Value = Description

ActiveCell.Offset(1, -1).Activate

If Not capital.Skip(1, "Stock") Then

Exit For

End If

Next i

Finished:

Range("A1").Select

Set capital = Nothing

End Sub

This next example queries the CAPITAL invoice table and produces a list of unpaid invoices or unallocated payments, as a list inside Excel.

Sub CapitalConnector()

Dim capital As Object

Dim InvNo As String

Dim InvDate As Date

Dim InvAmount As Currency

Dim InvAcc As String

Dim InvUnpaid As Currency

Dim AccountCode As String

Set capital = CreateObject("CapitalOfficeClass")

capital.ConnectPath ("c:\capital")

capital.OpenCompany ("sample")

Rem Open required table

capital.OpenTable ("Invoice")

AccountCode = InputBox("Enter the customer account code to list unpaid transactions payments for.")

AccountCode = Left(UCase(AccountCode) + String(8, " "), 8)

If Not capital.Find(AccountCode, "Invoice", 2) Then

MsgBox ("No match found")

GoTo Finished

End If

Range("A1").Select

ActiveCell.Value = "Account"

ActiveCell.Offset(0, 1).Activate

ActiveCell.Value = "Tran No."

ActiveCell.Offset(0, 1).Activate

ActiveCell.Value = "Date"

ActiveCell.Offset(0, 1).Activate

ActiveCell.Value = "Amount"

ActiveCell.Offset(0, 1).Activate

ActiveCell.Value = "Balance Owed"

Range("A1:E1").Font.Bold = True

Range("A2").Select

Do While (capital.Read("ACCCODE", "Invoice") = AccountCode)

If Not capital.Ispaid("Invoice") Then

InvAcc = capital.Read("Acccode", "Invoice")

InvNo = capital.Read("Invoiceno", "Invoice")

InvNo = capital.TranStr(InvNo)

InvDate = capital.Read("Date", "Invoice")

InvAmount = capital.Read("Invtot", "Invoice")

InvUnpaid = capital.Unpaid("Invoice")

ActiveCell.Value = InvAcc

ActiveCell.Offset(0, 1).Activate

ActiveCell.Value = InvNo

ActiveCell.Offset(0, 1).Activate

ActiveCell.Value = InvDate

ActiveCell.Offset(0, 1).Activate

ActiveCell.Value = InvAmount

ActiveCell.Offset(0, 1).Activate

ActiveCell.Value = InvUnpaid

ActiveCell.Offset(1, -4).Activate

End If

If Not capital.Skip(1, "Invoice") Then

Exit Do

End If

Loop

Finished:

Range("A1").Select

Set capital = Nothing

End Sub

Upon execution of the above code Excel will prompt for the customer account code:

After execution is completed the following typical output inside Excel should appear:

The actual output will vary depending on the contents of your database and which account code you select.

____________________________

Related Topics:

Find()

GotoTop()

GotoBottom()

OpenTable()

Read()

Skip()

Write()


Unsupported CBS Functions List

Function | Status | Comment
AnswerYes() | GUI | COM servers should not interact graphically with their clients.
EchoBoxOn() | GUI |
EchoBoxOff() | GUI |
EchoStatus() | GUI |
FormAdd() | GUI |
FormCreate() | GUI |
FormShow() | GUI |
FormResult() | GUI |
Lookup() | GUI |
WaitCursor() | GUI |
Input() | GUI |
InputFile() | GUI |
HoldRecord() | Missing Context | Applicable to Visual Builder.
Dictionary() | Missing Context | Applicable to Visual Builder.
PostMessage() | Missing Context |
CardFileBill() | Future Release |
ModemDial() | Future Release |
ComWrite() | Future Release |
ComError() | Future Release |
ComClose() | Future Release |
ComOpen() | Future Release |
ComRead() | Future Release |
ComSetup() | Future Release |
AddCustomer() | Future Release |
AddStock() | Future Release |
AddJobCard() | Future Release |
AddPayment() | Future Release |
AllocatePayment() | Future Release |
AddMail() | Future Release |
SendMail() | Future Release |
SendHTMLMail() | Future Release |
BackAllocate() | Future Release |
CopyToClipBoard() | Future Release |
LockSemaphore() | Future Release |
UnlockSemaphore() | Future Release |
PasswordInfo() | Future Release |
KitList() | Future Release |
JobInfo() | Future Release |
PriceUpdate() | Future Release |
ZipFile() | Future Release |
CreateEmailJob() | Future Release |
CreatePrintJob() | Future Release |
EventAdd() | Future Release |
TodoAdd() | Future Release |
GetStockQuantity() | Future Release |
ExpenseAnalysis() | Future Release |
StockAnalysis() | Future Release |
StockQuantity() | Future Release |
ReadNote() | Future Release |
WriteNote() | Future Release |
OpenVisualBuilder() | Future Release |
Journal() | Future Release |


Troubleshooting Connections

When developing application code to access the CAPITAL Connector, be sure to regularly check for error states using the ErrorCode() and ErrorMessage() methods in particular. If a method is unable to execute a request, a unique error number will be assigned to the incident. An explanatory textual explanation is included and available when calling ErrorMessage().

Typically, error conditions arise when required tables have not been opened using the OpenTable() method, or parameters passed to methods are of the wrong type or are missing. For example, if a method requires a string parameter but a numeric parameter is passed, an error condition will arise.

Be sure to consult the technical description of each Object Method before attempting to access it. The technical description explains all required parameters, return values and special conditions where applicable (such as the need to open tables).

Error codes are also echoed to the windows 'debug window' for convenient monitoring.

CAPITAL Connector Internal Problems

Should an internal problem arise within the CAPITAL Connector, causing it to shut down, then normally an error log will be written into the path folder specified when ConnectPath() was called. The error log will be called CapitalOfficeClass.log.

Internal errors may arise due to coding problems within the connector itself, or problems with data communications (for example, if a required data server is not accessible) or when a table is corrupted or damaged or cannot be opened for other reasons.

When reporting problems please include CapitalOfficeClass.log with your email as an attachment.


Installation Files

File | Description
CapitalOfficeClass.DLL | OLE COM Server
xHDBDLL.DLL | Runtime support for CapitalOffriceClass.DLL. You will be unable to install the CAPITAL Connector if this file is not located in the same folder as CapitalOfficeClass.DLL
ACE32.DLL | Required for Corporate Edition
AXCWS32.DLL | Required for Corporate Edition


AddRecord()

Adds a blank record to a specified database.

Syntax

AddRecord(cTable) --> lSuccess

Arguments

<cTable> --> The name of the database table to add the record to.

Returns

Returns a logical value of TRUE if the record was successfully added to the database.

Description

Use the AddRecord() method to add a new blank record to a database.

Do not use this method to add records to standard CAPITAL databases. Standard CAPITAL databases expect default values to be assigned to newly created records. The AddRecord() method does not assign these default values.

____________________________

Related Topics:

DeleteRecord()


CloseCompany()

Closes the currently open company.

Syntax

CloseCompany() --> None.

Arguments

None.

Returns

None.

Description

This method closes an opened company by closing all open CAPITAL database tables.

____________________________

Related Topics:

OpenCompany()


CloseIndex()

Closes an index file created by the IndexTable() method.

Syntax

CloseIndex(<cFile>)

Arguments

<cFile> --> The name of the database file, whose index you wish to close.

Returns

Nothing.

Description

This method removes an index added to a database via the IndexTable() method. It will restore the normal sort sequence of the database.

Comments

This method does not delete the physical index file. You must use an erase file method in your programming language to do this.

The IndexTable() method returns the name of the index file so that you may erase it later.

____________________________

Related Topics:

IndexTable()


CloseTable()

Closes a database table previously opened with the OpenTable() method.

Syntax

CloseTable(<cTable>)

Arguments

[<cTable>] --> The name of the database table to close. If <cTable> is not specified all tables opened with the OpenTable() method are closed.

Returns

Returns logical TRUE if the table was successfully closed, otherwise FALSE if there was a problem with the close request. This method would return FALSE if the requested table was not already open.

Description

This method closes a CAPITAL database (DBF) file previously opened with the OpenTable() method.

____________________________

Related Topics:

OpenTable()


CompressTable()

Physically removes deleted records from a database table in the currently open company folder.

Syntax

CompressTable(<cTable>) --> lResult

Arguments

<cTable> --> The name of the database table to open.

Returns

Returns logical TRUE if the table was successfully compressed, otherwise FALSE if there was a problem with the compression request. For example, the table could not be found or could not be opened exclusively.

Description

This method compresses a CAPITAL database table. This action physically removes all records flagged as deleted from the table.

A database table can only be compressed if it can successfully be opened exclusively. This means that no other system or process may have the table open at the same time. If the table is already open in another session or on another PC, this method will return a FALSE statement. However, this will not raise an error message in this case.

____________________________

Related Topics:

CreateTable()

OpenTable()


ConnectPath()

Establishes a connection with CAPITAL database installation.

Syntax

ConnectPath(<cPath>) --> lResult

Arguments

<cPath> --> A drive mapped or URL path that points to a \CAPITAL folder.

Returns

Returns logical TRUE if the connection attempt was successful.

Returns logical FALSE if the connection attempt fails. A connection attempt will fail if the specified path does not exist.

Description

This method establishes a connection with a CAPITAL database installation. It must be called before any other connector class method is called.

____________________________

Related Topics:

Establishing A Connection

OpenCompany()

OpenTable()


CreateTable()

Create a database table in the currently open company folder.

Syntax

CreateTable(<cFilename>, <aFields>, <aFldTypes>, <aFldLengths>, <aFldDecimals>)

Arguments

<cFilename> --> The name of the database file to create.

<aFields> --> An array containing a list of field names. Each field name must be defined as a string no greater than 10 characters wide.

<aFldTypes> --> An array containing a list of field types. Valid field types include strings "C" (character type), dates "D" (date type) and numbers "N" (numeric type).

<aFldLengths> --> An array containing a list of field lengths. Valid field lengths must consist of numeric values greater than zero and less than 1025.

If fields are created with a length greater than 254 they will not be compatible with the generic DBF format and may not be readable or correctly read, by all external applications.

<aFldDecimals> --> An array containing a list of field decimal places. Valid field decimals must consist of numeric values greater than zero and less than 253. If the field type is not numeric, the field decimal must be zero. The field decimal must also be at least 2 numbers less than the field size.

Returns

Returns logical TRUE if the table was successfully created, otherwise logical FALSE.

Description

This method creates an empty database table of a specified structure.

Examples

Creates a database table consisting of 2 character fields and one numeric field:

capital.CreateTable( "MyTable", { "Tom", "Dick", "Harry" }, { "C", "C", "N" }, { 10, 10, 12 }, { 0, 0, 2 } )

____________________________

Related Topics:

OpenTable()


DeleteRecord()

Marks the currently selected record as deleted.

Syntax

DeleteRecord(cTable) --> None.

Arguments

<cTable> --> The table to delete the record from.

Returns

None.

Description

Use the DeleteRecord() method to mark a record as deleted from the database.

Before deleting a record it is important that it has been locked first. Call the LockRecord() method before attempting to delete a record.

Deleting records within the standard CAPITAL databases may result in corruption and other problems with your accounting data. Only use this method if you have confidence that this will not occur.

____________________________

Related Topics:

AddRecord()

LockRecord()


Echo()

Display a message box.

Syntax

Echo(<cMessage>) --> None

Arguments

<cMessage> --> is the text message to display.

Returns

None.

Description

Displays a text message on the Window in a dialog box. Use this method to test if you have established a connection with the CAPITALOfficeClass COM service.

Example

* Display the message "Hello World"

capital.Echo('Hello World')


EndOfTable()

Determines whether the record pointer has reached the end of the database table.

Syntax

EndofTable(cTable)

Arguments

<cTable> --> The name of the database table to check for end of record set condition.

Returns

Returns logical TRUE if the database table pointer is at the end of the table.

Description

This method determines if the record pointer has reached the end of the database table record set. You should specify the table reference to ensure that you are returning a result for the intended table.

Example

capital.Skip(MyTable)

If capital.EndOfRecord(MyTable)

...

Endif


ErrorCode()

Return error code from last error state.

Syntax

ErrorCode() --> nErrorCode

Arguments

None.

Returns

Returns the error code number from the last error state or zero if no error has occurred.

Description

Use the ErrorCode() number to establish if an error condition has arisen. Use ErrorMessage() to obtain a text description of the error code.

____________________________

Related Topics:

ErrorMessage()

ErrorSubCode()


ErrorMessage()

Return error code message from the last error state.

Syntax

ErrorMessage() --> cErrorMessage

Arguments

None.

Returns

Returns the error code text message from the last error state or an empty string if no error has occurred.

Description

Use the ErrorMessage() method to obtain the text description of an error code.

____________________________

Related Topics:

ErrorCode()

ErrorSubCode()


ErrorSubCode()

Returns the error sub code from the last error state.

Syntax

ErrorSubCode() --> nSubCodeError

Arguments

None.

Returns

Returns the error subcode from the last error state or zero if there is no subcode.

Description

Use the ErrorSubCode() method to obtain further information on an error state for diagnostic purposes.

____________________________

Related Topics:

ErrorCode()

ErrorMessage()


FilterTable()

Returns, sets or clears a filter on a selected database table.

Syntax

FilterTable([<cExpression>], <cTable>) --> lSuccess

Arguments

<cExpression> --> A filter expression to apply to the table.

<cTable> --> The name of the table to filter.

Returns

Returns TRUE if the operation was successful, otherwise FALSE.

Description

This method sets, returns or clears a filter condition applied to a database table. A filter condition hides from view any records that do not match the filter condition. Skip() and Find() and GotoTop() and GotoBottom() will not 'see' filtered records. However, if the record number is know, Goto() can still position the record pointer onto a filtered record.

To return the existing filter expression in use (if any), do not pass any parameters. e.g.,

FilterTable(, MyTable)

To clear a filter expression, pass an empty string, e.g.,

FilterTable("", MyTable)

To set a filter, pass a valid expression as a character string. Valid expressions may include a mix of CBS functions, variables, values and operators such as > and =.

Example

FilterTable("Price1 > 0", MyTable)


Find()

Finds/positions a record.

Syntax

Find(<xData>, <cTable>, <ncOrder>, <lNotExact>, <lLast>)

Arguments

<xData> --> The data to find.

<cTable> --> The table to search.

<ncOrder> --> The optional sort order as a number or the order as a character string representing the name of the sort order.

For card file databases the name of the order is the same as the name of the field being sorted.

The first sort order (the key) of the form's main table is used if the sort order is not specified.

<lNotExact> --> If not specified, CAPITAL performs an exact match. If TRUE is specified CAPITAL will match the next closest value if it exits.

<lLast> --> If not specified, CAPITAL finds the first matching record in the table to be searched. If specified, CAPITAL finds the last matching record in the table instead.

Returns

Returns logical TRUE if the record was found, otherwise logical FALSE.

Description

Find() locates the first record whose key value matches <xData>. If the record is found the method returns logical TRUE. Otherwise logical FALSE is returned. The database being searched must have applicable index files associated with it.

<ncOrder> refers to the sort order. It defaults to 1 (the first sort order or main key) if not specified. If a database has more than one pre-defined sort order, then specify 2 for the 2nd sort order, 3 for the third and so on. To view the list of available sort orders under Visual Builder, go to the Links tab and click on the Sort list.

If you know the name of the sort order you can specify the name instead as a character string. For card file databases the name of the sort order always matches the name of the field being sorted, so if you are sorting on a field called DATE, then the sort order will also be called DATE.

<lNotExact> defaults to FALSE. CAPITAL will try to match the entry exactly if FALSE is passed. If TRUE is passed and there is no exact match in the system, the next closest match in alphabetical order is located unless the end of the file is encountered first.

Examples

* Locate the contents of cName

capital.Find(cName, MyTable)

* Locate the contents of cName but search on the second order.

capital.Find(cName, MyTable, 2)

* Locate the closest match to cName if there is no exact match

capital.Find(cName, MyTable,, TRUE)

* Locate the date dMyDate and search on the Date sort order.

capital.Find(dMyDate, MyTable, "Date")


Goto()

Moves to a specified record number.

Syntax

Goto(<nRecordNumber>, <cTable>) --> lResult

Arguments

<nRecordNumber> --> A number value that specifies the record number sought.

<cTable> --> The name of the table to navigate through.

Returns

Goto() returns TRUE if moving to the requested record number was successful. Otherwise FALSE is returned.

Description

Goto() moves to the record whose record number is equal to <nRecordNumber>. If the record number requested is outside the range of available records the record number is moved to the end of the database.

____________________________

Related Topics:

GotoBottom()

GotoTop()

Skip()


GotoBottom()

Moves to the last record.

Syntax

GotoBottom(<cTable>) --> TRUE

Arguments

<cTable> --> The table to move to the bottom of.

Returns

Always returns TRUE.

Description

GotoBottom() moves to the last record in the database. The last record is determined by the currently active sort sequence.

____________________________

Related Topics:

Goto()

GotoTop()


GotoTop()

Moves to the first record number.

Syntax

GotoTop(<cTable>) --> TRUE

Arguments

<cTable> --> The table to move to the top of.

Returns

Always returns TRUE.

Description

GotoTop() moves to the first record in the database. The first record is determined by the currently active sort sequence.

____________________________

Related Topics:

Goto()

GotoBottom()


IndexTable()

Sorts a database table based on a key expression.

Syntax

IndexTable(<cTable>, <cKey>, [<cFor>])

Arguments

<cTable> --> Is the name of the database table to index (temporarily sort). The table must already be open. If not open it should be opened with the OpenTable() method.

<cKey> --> The key expression to sort the table on. This must be expressed as a character string.

<cFor> --> Is an optional character expression that defines a matching condition that must exist in the database table for the record to be included in the index.

Returns

If the index file was successfully created its name is returned as a character string. Otherwise if there is a problem an empty string ( "" ) is returned.

Description

This method temporarily sorts a database table into a customized ordering. The database table must already be open or has been explicitedly opened using the OpenTable() method. The key expression defines the sorting order based on the contents of the fields in the database.

When you have finished with the created index it should be closed using the CloseIndex() method.

Examples

* Sort DOCKET database on CODE field.

capital.OpenTable("Docket")

IndexFile := capital.IndexTable("Docket", "Code")

The next example sorts the database on CODE plus DATE. Note that the DATE field must be converted, using the DTOS() function, to a character string of the format YYYMMDD to ensure that it can be added to the CODE field (which is a character field) and that the sorting sequence is correct.

capital.OpenTable("Docket")

capital.IndexTable("Docket", "Code+DTOS(Date)")

The next example sorts on the NAME field in uppercase, but only for records that have a BILLING field that equals "Y". Records that do not meet this condition are no longer visible after the index process is completed.

OpenTable("Bins")

capital.IndexTable("Bins", "Upper(Name)", "Billed == 'Y')

Records that do not meet the condition Billed == 'Y' will be invisible unless the Find() method is used to change the sorting order, or until the table is closed using the CloseTable() method.

____________________________

Related Topics:

CreateTable()


IsOpenTable()

Establishes whether a database table is already open.

Syntax

IsOpenTable(<cTable>) --> lSuccess

Arguments

<cTable> --> The name of the database table to check for.

Returns

Returns TRUE if the database table is already open.

Description

This method checks to see if a particular database table is already open.

____________________________

Related Topics:

OpenTable()

CloseTable()


IsPaid()

Determines if a transaction is fully paid or if a payment, fully allocated.

Syntax

IsPaid(<cTable>) --> lPaid

Arguments

<cTable> --> The name of the table to query. The status of the selected record within the specified table is checked.

Returns

Logical TRUE is returned if the transaction is fully paid or if a payment, whether it is fully allocated against other transactions; otherwise logical FALSE is returned. If the Invoice or Accpay database has not been opened logical FALSE is always returned.

Description

Determines whether a transaction is paid up and returns logical TRUE if so. If the transaction is a payment and it is fully allocated against invoices, a logical TRUE is also returned. Only transactions held in either the Invoice (customer transactions) database or Accpay (supplier transactions) database can be paid or unpaid.

Example

If capital.IsPaid("Invoice")

...


IsPayment()

Determines if a transaction is a payment.

Syntax

IsPayment(cTable) --> lPayment

Arguments

<cTable> --> The name of the table to query. The status of the selected record within the specified table is checked.

Returns

Logical TRUE is returned if the transaction is a payment, otherwise logical FALSE is returned. If the Invoice or Accpay database has not been opened, logical FALSE is always returned.

Description

Determines whether a transaction is a payment and returns logical TRUE if so. Only transactions held in either the Invoice (customer transactions) database or Accpay (supplier transactions) database can be payments. Your program must therefore open either the Invoice or Accpay database.

Example

If capital.IsPayment(MyTable)

...

____________________________

Related Topics:

Unpaid()


LockRecord()

Locks the currently selected record or records in the current or specified database.

Syntax

LockRecord([<lAll>], <cTable>) --> lResult

Arguments

<lAll> --> You may optionally pass TRUE to this method to attempt to lock all records within the specified table. If FALSE is passed or this parameter omitted, this method will only attempt to lock the currently pointed to record.

<cTable> --> The database table to lock.

Returns

Returns TRUE if the record was successfully locked, otherwise FALSE.

Description

LockRecord() is a network method that locks the current record or all records of a table, preventing other users from updating the record or records until the lock is released. The record can still be read by other users. A record lock remains until another record is locked, or the UnlockRecord() method is called for the same record or the database table is closed.

For each invocation of LockRecord(), there is one attempt to lock the current record, and the result is returned as a TRUE or FALSE value. An attempt to obtain a record lock fails if another user or application has already locked the record. An attempt to lock all records will fail if any record is already locked by another user.

If capital.LockRecord(MyTable)

...

capital.UnlockRecord(MyTable)

You do not need to use record locking to write data to CAPITAL's databases using the Write() method. The record will automatically be locked for the duration of the write.

When you have finished writing to the record you must unlock it using the UnlockRecord() method. Other users on your network may be prevented from working on the data contained in the database until you unlock it.

____________________________

Related Topics:

UnlockRecord()


OpenCompany()

Opens a company.

Syntax

OpenCompany(<cCompanyCode>) --> lSuccess

Arguments

<cCompanyCode> --> The name of the company folder to open.

Returns

Returns logical TRUE if the company was successfully opened, otherwise FALSE if there was a problem with the open request: such as there being no company with the specified cCompanyCode existing.

Description

This method opens a company.

After successfully opening a company use the OpenTable() method to open one or more database tables.

____________________________

Related Topics:

CloseCompany()


OpenTable()

Opens a database table in the currently open company folder.

Syntax

OpenTable(<cTable>, [<cName>]) --> lResult

Arguments

<cTable> --> The name of the database file to open.

<cName> --> Optionally specifies an alternate name for the opened table. If not specified, the name will be <cTable>. The table name should not contain spaces or punctuation. The table name must also start with a letter of the alphabet.

Returns

Returns logical TRUE if the table was successfully opened, otherwise FALSE if there was a problem with the open request: such as the table not existing.

Description

This method opens a CAPITAL database table.

You can execute the OpenTable() method multiple times, however the table is only opened once. If the table is already open the OpenTable() method is ignored. If you wish to open the same table more than once you must give it a different name.

Use the CloseTable() method to close the table after you have finished working with it.

____________________________

Related Topics:

CloseTable()


OrderTable()

Returns or sets the sort order and order name of a selected database table.

Syntax

OrderTable([cOrderName|nOrderNumber], <cTable>) --> { nOrder, cSortName }

Arguments

<cOrderName|nOrderNumber> --> If specified this is the order name to specify or the order number.

<cTable> --> The name of the table to set the order for.

Returns

Returns an array containing two elements:

<nOrder> --> is the current index sort order of the table. This is a numeric value. If there is no current index sort order this value will be zero.

<cSortName> --> the name of the index sort order of the table. This is a character string. If there is no current index sort order this value will be an empty "" string.

Description

This method sets or returns the index sort order and index sort order name of a selected database. It is useful if you need to change the sort order of a table and possibly restore it to its default later.

For a card file database the sort order name always matches the name of the field that was sorted. A sort order name of "DATE" means that the sort order is based on the DATE field.


Read()

Returns the field value of the specified database field.

Syntax

Read(<cName>, <cTable>) --> xField

Arguments

<cName> --> The name of the field to retrieve.

<cTable> --> The name of the table to retrieve the field information from.

Returns

Returns the field value of <cName>.

Description

This method returns the field value of the field name specified by <cName> from the table <cTable>. It is assumed that the database has been opened using the OpenTable() method.

Example

capital.Read("Name", "Supplier"))

The contents of the supplier field "Name" is returned.

capital.Read("Location", "Stock"))

The contents of the stock field "Location" is returned.

____________________________

Related Topics:

Write()


RecordNo()

Returns the record number of the selected database.

Syntax

RecordNo(<cTable>) --> nRecord

Arguments

<cTable> --> The name of the table to query.

Returns

Returns the current record number as a numeric value.

Description

The record number is a numeric value that indicates the position of a record in the selected database according to its physical location within the file. The physical location of a record generally refers to its relative input order. The 20th stock record entered into the system would have a record number of 20. The record number of a record may change after a Database Maintenance operation is performed, as deleted records may be removed from the sequence, causing other records to be renumbered to fill the gaps.

Example

capital.OpenTable("Supplier")

capital.RecordNo("Supplier")

____________________________

Related Topics:

Goto()


ScriptRun()

Run (execute) a CAPITAL script from within a script or an area of CAPITAL that supports scripting instructions.

Syntax

ScriptRun(<cFile|cScript>)) --> lExecuted

Arguments

<cFile> --> is a .MAC file that must exist in a location accessible to CAPITAL. If the extension ".MAC" is found in the string or variable passed to ScriptRun() then CAPITAL attempts to locate, load, and execute the contents of this file.

<cScript> --> You may pass a string variable containing a script directly to the ScriptRun() method for execution.

Returns

ScriptRun() returns a Nil or void value if the script was not successfully executed. Otherwise the value returned by the script is returned.

Description

This method executes a script from within a script or area of CAPITAL where the return value from a script may be used.

Example

capital.ScriptRun("f:\capital\myscript.mac")

____________________________

Related Topics:

Unsupported CBS Function List


Skip()

Move relative to the current record.

Syntax

Skip([<nRecords>], <cTable>) --> lEnd

Arguments

<nRecords> --> is the number of records to move, relative to the current record. A positive value means to skip forward, and a negative value means to skip backward. If <nRecords> is omitted, a value of 1 is assumed.

<cTable> --> The database table to skip.

Returns

Skip() returns TRUE until the beginning or the end of the database is reached. The end of the database is defined as the "next record past the last record." When the next record past the last record is reached, logical FALSE is returned. If you are moving backwards through the record list, Skip() returns FALSE when an attempt is made to move before the first record.

Description

Skip() moves either forward or backward relative to the current record. The forward or backward movement is determined by the sequence set by the sort ordering of the database table. If the database table is not sorted, then movement forward or backward is determined by the original order of input of the database records.

____________________________

Related Topics:

Goto()

OrderTable()


SpecialName()

Displays the discount name or special price rule description for a selected stock item located on a transaction.

Syntax

SpecialPrice(<cTable>) --> cDiscountName

Arguments

<cTable> --> Specify the table name of the current transaction line item record.

See the following table:

Table | Description
CONTENTS | The invoice items contents table.
OSTOCK | The sales order items contents table.
QSTOCK | The quotation item contents table.

No other table names should be passed to this method.

Returns

Returns the description of the discount.

Description

The discount description may the discount percentage or Discount Name if the line item has a special price rule associated with. If there is no discount associated with the line item then a blank string value is returned.

Unless you are accessing internal information you must open the table associated with the record you wish to query before calling this method.

Example

// Returns the discount name for a record found in

// invoice items contents file

capital.SpecialName("Contents")

Notes

See the documentation on Customer Special Pricing for information on how rule and price selection occurs under CAPITAL.

____________________________

Related Topics:

SpecialPrice()


SpecialPrice()

Calculates the customer specific sell price of a stock item by inspecting the Customer Special Price Matrix when applicable.

Syntax

SpecialPrice(<cAccount>, <cStockID>, <nQtyBreak>, <dDate>, <cDepartment>) --> nPrice

Arguments

<cAccount> --> Customer account code. If not specified, the one in the current customer record is used. Pass an empty string ("") to return a value that is not account specific.

<cStockID> --> The stock ID number to base the sell price on. If not specified, the one in the current stock record is used.

The Stock ID can be retrieved using the StockID() method.

<nQtyBreak> --> The price to return based on a quantity break purchase of this amount or more. If a value is not specified a quantity break of zero or more is assumed.

<dDate> -->The date for which any sale is said to occur. This would only apply if your pricing changed according to the date of the transaction, i.e., a one month special. If not specified the current system date is assumed.

<cDepartment> --> The department code. If not specified the department field is set to a blank code. This would only apply if your pricing varied according to the department that sold the goods.

Returns

Returns the sell price based on the current customer account and stock item being sold.

Description

This method returns the sell price of a stock item based on the rules specified in the Customer Special Price Matrix. If no rules apply, the default system sell price is returned.

If a customer account code or Stock ID is not specified, the system will return the price based on the currently selected customer record and/or stock record. If you do not want an account specific price to be returned, pass an empty string such as: ""

In order to use this method you must open these tables first before calling Specialprice():

1. Customer file (Custrec)

2. Stock file (Stock)

3. Customer Special Price Table (Matrix)

4. Stock Groups (Type)

5. Invoicing (Invoice)

Unless all these files are opened, the return price will always be zero.

Example

capital.Opentable("Custrec")

capital.Opentable("Stock")

capital.Opentable("Matrix")

capital.Opentable("Type")

capital.Opentable("Invoice")

// Returns the sell price of the currently selected stock

// item (first record in Stock table) based on a quantity

// break purchase of 50 or more

// for customer account code ACME.

capital.SpecialPrice("ACME",, 50)

// Returns the sell price for all customers

capital.SpecialPrice("")

// Return the sell price for selected customer

capital.Specialprice()

Notes

Consult the documentation on Customer Special Pricing for information on how rule and price selection occurs under CAPITAL.

____________________________

Related Topics:

SpecialName()


StockDescription()

Returns the extended stock item description.

Syntax

StockDescription() --> cDescription

Arguments

The stock record for which you want the extended stock description returned must be selected before calling this method.

Returns

Returns the product description or an empty character string if the stock table is not available.

Description

Returns the full product description of the stock item being pointed to by the system. CAPITAL stores the first 40 characters of the production description in the field Stock.Title. To obtain the full product description, the method StockDescription() must be called instead.


StockID()

Returns the stock id of the currently selected stock record.

Syntax

StockID() --> <cStockID>

Returns

<cStockID> --> is the stock id of the stock record as a 7 digit number formatted as a character string. If the Stock database table is not open a blank string is returned.

Description

Returns the Stock ID of the currently selected stock record. If no stock record is available then a blank string ("") is returned. Otherwise an ID, such as "0000001" is returned. Non-blank Stock ID's are always unique.


StockMovement()

Returns information about a stock item's movement history.

Syntax

StockMovement(<cProduct>, [<cLocation>], <dDate1>, [<dDate2>]) --> aInfo

Arguments

<cProduct> --> The product code.

<cLocation> --> The product code's location. This must be supplied if the company has multi-location stock control activated.

<dDate1> --> The start date to report on.

<dDate2> --> The end date to report on. If this parameter is not supplied it is assumed that the end date is the same as the start date.

Returns

Returns an array containing 12 elements. The meaning of each element is listed in the following table:

Element No. | Meaning | Type
1 | The product code. | Character
2 | The product description. | Character
3 | The product location. | Character
4 | The Stock ID. | Character
5 | The opening stock quantity at the start date specified. | Numeric
6 | Total stock received from dDate1 to dDate2. (This includes purchase orders, stock returns and receipts.) | Numeric
7 | Total quantity sold or moved out from dDate1 to dDate2. | Numeric
8 | Quantity of miscellaneous adjustments from dDate1 to dDate2. | Numeric
9 | Total closing stock quantity as at dDate2. | Numeric
10 | Total quantity received from purchase orders between dDate1 and dDate2. | Numeric
11 | Total quantity received from stock receipts between dDate1 and dDate2. | Numeric
12 | Total quantity received from stock returns between dDate1 and dDate2. | Numeric

If the stock item cannot be found, FALSE is returned.

Description

This method returns stock item and movement information on a specified stock item.

Notes

The table Stock must be open before calling this method.

Example

// Return quantity dispatched or sold between 01/01/03

// and 31/12/04 for product item ABC

Info := capital.StockMovement("ABC",, CTOD("01/01/03"), CTOD("31/12/03"))


StockPrice()

Retrieve a stock control price field.

Syntax

StockPrice(<nPriceType>]) --> nValue

Arguments

<nPriceType> --> A number between 1 and 16. Refer to the table below for return values for each price type.

nPriceType | Return Value | Mandatory
1 | Cost in store (CIS) price. This is the price used for evaluating inventory cost and is normally the same as the system average cost price. | Yes
2 | Average cost price. | No
3 | Last cost price exclusive of taxes. | No
4 | Default invoice cost price exclusive of taxes. This is normally the same as the cost in store (CIS) price. | Yes
5 | Default sell price exclusive of tax. This is typically the standard sell price when no other special price or discount applies. | Yes
6 | Default cost inclusive of tax. This is typically the same as the default calculated invoice cost price excluding tax. In most business environments the cost price of an item does not change because tax may be applicable. Rather, taxes are normally calculated and maintained separately from the item's initial cost. | Yes
7 | Default sell price inclusive of tax. This is typically the same as the invoice sell price excluding taxes. In most business environments the sell price of an item does not change because taxes may be applicable, except of course in the sense that tax is added to the sell price. This is because tax is usually tracked separately from the sell price (even when the sell price is presented as inclusive of tax). | Yes
8 | Default list price exclusive of tax. | No
9 | Default list price inclusive of tax. | No
10 | Buy price exclusive of tax. This is typically the purchase order buy price of a stock item. | Yes
11 | Box buy price exclusive of tax. This is the unit purchase price when purchasing in boxes, crates, etc. This price will be used in place of Buy Price Exclusive of Tax when the Stock Control Box Conversion factor for a stock item is not set to zero or 1, and when no other alternate box buy price has been specified for a particular unit of measure. | No
12 | The last cost price inclusive of applicable taxes. | No
13 | Unit tax amount of the stock item. This is often not tracked or maintained separately in stock control in most company configurations. |
14 | Last unit purchase cost in base currency. | No
15 | The default sell price exclusive of tax in box units. This price field is provided for backward compatibility. | No
16 | The default sell price inclusive of tax in box units. This price field is provided for backward compatibility. | No

Returns

Returns the requested stock control price field. If a particular price type has not been defined in a particular company configuration, then a value of zero is returned.

Description

This method is used to return a particular stock item price from stock control. It can be used to retrieve the average cost, last cost, default item sell price and other types of price definitions.

Not all price definitions may be available in all company configurations.


Today()

Return the CAPITAL system database log in date as a date value.

Syntax

Today() --> dDate

Returns

Today() returns the log in date as a date value. If no date log in was requested the computer or network's system date is used.

Description

Today() is a date method that provides a means of assigning variables to the current log in date. The display format of all date variables is dd/mm/yy.


TranInfo()

Returns information about the currently selected transaction.

Syntax

TranInfo(<nTranType>, <nOp>) --> xResult

Arguments

<nTranType> --> The transaction type to query.

nTranType | Description | Tables Required
1 | Invoice and related transactions. | INVOICE (CONTENTS and STOCK must also be open for calculating weight or volume.)

<nOp> --> The type of information to return.

Returns

Returns the requested information. A value of -1 is returned if an error condition arises.

Description

This method returns information about the currently selected transaction. The relevant transaction table must be open before calling this method. The information request and return data is documented in the following table.

nOp | Description
1 | Invoice total in base currency.
2 | Invoice total in the currency of the transaction.
3 | The tax or GST total of the transaction.
4 | The freight charge. This may include tax or GST if the freight charge is inclusive of tax or GST.
5 | The total of all freight and miscellaneous charges. This may include tax or GST if the freight charge is inclusive of tax or GST.
6 | The first miscellaneous charge total. This may include tax or GST if the freight charge is inclusive of tax or GST.
7 | The second miscellaneous charge total. This may include tax or GST if the freight charge is inclusive of tax or GST.
8 | The third miscellaneous charge total. This may include tax or GST if the freight charge is inclusive of tax or GST.
9 | The tax or GST component of all freight and miscellaneous charges.
10 | The total of freight and miscellaneous charges, less tax or GST.
11 | The total of freight plus tax or GST.
12 | The freight charge less tax or GST.
13 | Miscellaneous charge #1 less tax or GST.
14 | Miscellaneous charge #2 less tax or GST.
15 | Miscellaneous charge #3 less tax or GST.
16 | The unpaid portion of the transaction.
17 | The balance remaining on the transaction.
18 | The transaction cost.
19 | The transaction cost plus tax or GST.
20 | The transaction subtotal, less freight and all exclusive tax or GST.
21 | The transaction subtotal less freight and all taxes or GST.
22 | The transaction sub-total including all taxes or GST.
23 | The transaction total less exclusive tax or GST.
24 | The transaction total less all taxes or GST.
25 | The amount of tax or GST that has been added to the invoice net total.
26 | The amount of non-exempt tax or GST that applies to the transaction.
27 | The amount of 'change' issued on the transaction for rounding purposes.
28 | The total weight of the transaction. The table CONTENTS and STOCK must also be open in order to query this value.
29 | The total volume of the transaction. The table CONTENTS and STOCK must also be open in order to query this value.

If this method is used to query the contents of a payment transaction, the return value is always zero.


TranStr()

Converts a transaction number into a character string.

Syntax

TranStr(<cTran>) --> cString

Arguments

<cTran> --> Text string

Returns

A formatted transaction number string.

Description

Converts a transaction number into a character string without leading or trailing spaces.


UnlockRecord()

Unlocks the currently selected record in the current or specified database table.

Syntax

UnlockRecord(<cTable>) --> Nil

Arguments

<cTable> --> The database table to lock.

Returns

No return value.

Description

UnLockRecord() is a network method that unlocks the current record, allowing other users or applications to also change the contents of the record.

Note that any changes you have made to the current record do not become visible to other users on the network until you call the UnlockRecord() method.

Examples

This script unlocks the currently selected record in the table Dockets:

capital.UnlockRecord("Dockets")

____________________________

Related Topics:

LockRecord()


Unpaid()

Returns the amount of a transaction that is unpaid or unallocated.

Syntax

Unpaid(<cTable>) --> nUnpaidAmount

Arguments

<cTable> --> The name of the table to query. The status of the selected record within the specified table is checked.

Returns

Returns the amount of money owing on a transaction or if a payment or credit, the amount that has not been allocated against invoices.

Description

Returns the amount unpaid on a transaction or not fully allocated if it is a payment or credit. Only transactions held in either the Invoice (customer transactions) database or Accpay (supplier transactions) database can have an amount unpaid or unallocated. The form must therefore open either the Invoice or Accpay database.

Example

If capital.Unpaid("INVOICE") > 0

...

Notes

The unpaid amount is returned in the currency of the transaction. Use the transaction's exchange rate to calculate the unpaid amount in local currency where applicable.

____________________________

Related Topics:

IsPayment()


Version()

Returns the major release version number of CAPITAL.

Syntax

Version([<nType>]) --> nVerion

Arguments

<nType> --> optionally return the type of version information required. The valid range is between 0-2. To ascertain the data version do not specify nType.

The valid range value and number of return values may be expanded in future editions of CAPITAL.

nType | Return Value
None | The major release version number as a numeric value.
0 | The build identifier. E.g., 10002-470-SL0
1 | The CAPITAL application that is running. Returns the string "Server".
2 | The Edition of CAPITAL running. Possible return values include: CAPITAL Professional Edition = "Professional" CAPITAL Enterprise Edition = "Enterprise" CAPITAL Corporate Edition = "Corporate" CAPITAL Evaluation = "Evaluation"

Returns

The major release version number as a numeric value is the default return value. Other return values depend on the version type specified by nType. If a version query is not understood, Version() returns -1.


Write()

Changes the value of a database field.

Syntax

Write(<cField>, <cTable>, <xData>) --> lSuccess

Arguments

<cField> --> The name of the field in the selected database.

<cTable> --> The name of the table to store the field information in.

<xData> --> The value to assign to the given field. The data type of this expression must match the data type of the designated database field.

Returns

Logical TRUE is returned if writing to the database was successful. Otherwise logical FALSE if the write attempt failed.

Description

This method is used to save or update information stored in a database table.

If misused this method can CORRUPT the data contained in your accounting records.

The field name <cField> must exist in the selected or designated database table. The value <xData> must be of the same type as the field referred to by <cField>. So if <cField> refers to a character string, <xData> must also be a character string.

An attempt to write (update) a database may fail if the contents of <xData> is not valid or appropriate or if the record cannot be locked. A record cannot be locked if that same record is also being updated by another CAPITAL process or application. Therefore you may wish to use the LockRecord() method call first, to establish if locking is possible.

Examples

capital.Write("Title", "Stock", xValue)

____________________________

Related Topics:

Read()


CBS

Capital Business Script (CBS)

The in-built accounting and database programming language of CAPITAL.

CAPITAL Business Script (or CBS for short) can be used for a variety of different purposes:

Price calculations and updates

System behaviours when adding, editing, deleting and printing accounting records.

Report writing

Data import and manipulation

Interfacing with third-party computer software.

For writing 'vertical market' utilities and applications within the CAPITAL accounting system.

Business Script is documented in the CAPITAL Visual Builder help file.

Scripts are designed for use by advanced users who already possess scripting or computer programming skills.