generate/cbs2.gif Filter Record Hook (R-CUFLTn.MAC, R-SUFLTn.MAC, R-STFLTn.MAC) generate/enh74c.jpg

Corporate Edition Only


 

The script file must be located in your CAPITAL program directory and depending on the area that is being filtered, it may have the following range of file names:

Area

File Name

Stock Control

R-STFLTn.MAC where n is a number between 0 and 9.

Customer Accounts

R-CUFLTn.MAC where n is a number between 0 and 9.

Supplier Accounts

R-SUFLTn.MAC where n is a number between 0 and 9.

If the script is selected, it is executed every time a request is made to show a filtered view of the relevant section of the database. Scripts are selected using the Record Filters window.

Entry Values

None.

Return Values

A filter statement returned as a character string.

Comments

A filter script should consist of two lines of the following general lay-out:

* Name/Description of Hook

Return "X"

Where "X" is the filter condition.

Users may select up to 10 different filter conditions per area. For example, if you create the .MAC files R-STFLT0.MAC and R-STFLT1.MAC, both of these will be visible for selection from the Record Filters window.

generate/notepad2.gifCorporate server based filter statements should only reference database fields pertaining to stock, customer or supplier records. Complex CBS functions may not be included in expressions as the Corporate database server is 'client independent' and will not recognise functions that reference the local environment rather than the contents of the data in the table being filtered. For more information on this subject consult the topic: Corporate Edition Sort & Filter Expressions.

Example Filter Expressions

Example Filter Expressions

Area

STOCK

Purpose

Do not list stock items that are out of stock.

Expression

"Val(Stock_in) > 0"

Area

STOCK

Purpose

Only list stock items that are not on hold.

Expression

".NOT. Hold = 'Y'"

Area

STOCK

Purpose

Only list recently stock where we have more than 100 units of that stock available which has been assigned a stock group.

Expression

"Val(Stock_in) >= 100 .AND. .NOT. Len(Trim(Type)) = 0"

Area

STOCK

Purpose

Only list stock items that have arrived in the last 3 months that have not been fully allocated to customers.

Expression

"CTOD('" + DTOC(Today())'" + " - 90 > Delivery .AND. Val(Stock_in) - Val(Allocated) > 0"

Area

CUSTOMERS

Purpose

Only view customers assigned to the user's department or for which no department has been assigned.

Expression

"Cusdepart = '" + DepSet + '" .OR. Len(Trim(Cusdepart)) = 0"

Area

SUPPLIERS

Purpose

List all suppliers who work in US dollars.

Expression

"Currency = 'USD'"

Area

SUPPLIERS

Purpose

List all suppliers who match the current default department code.

Expression

"Department = '" + DepSet + '" .OR. Len(Trim(Department)) = 0"

Example Filter #1

* List Suppliers in US Dollars

Return "Currency = 'USD'"

Example Filter #2

* Available Physical Stock

"Val(Stock_in) > 0"

____________________________

Related Topics:

Corporate Edition Sort & Filter Expressions

Log In Hook

Record Filters

Scripting Hooks

Script Programming



Help Topic Map