4D 3.5 Tips [Dec 1996]

Better Auto-Wildcad Search

4D 3.5 has nice feature - Auto Wildcard Support, which allows quickly search and display list of records from one file typing just part of word. However, the following shortcomings encourage me to develop replacement: list is not sorted, window is small, not customizable and could not be placed in the center of screen. I found it almost unusable for inventory control system with several thousands of stock items. Comparison between my DistinctValues package and built-in 4D feature is below:

Feature

4D Built-in

DistinctValues package

Custom layout, custom window placement

No

Yes

Works with non-related records

No

Yes

Default Sorting in ascending order

No

Yes

Ability to accept custom sorting procedure as parameter

No

Yes

Ability to search selection

No

Yes

Remembers created selection

No

Yes

Runs in separate process

No

Yes

Wildcard search

Yes

Yes

Optimized for 4D Server

Yes

Yes

Here is how DistinctValues displays stock items from inventory searched by PMAC prefix (note: items may be chosen either with OK button either with double click).

DistinctValues package consist of several 4D procedures, can be easily moved across databases with 4D Insider, requires just one line of code: ValToFind:=DistinctValues(>>[STOCK_ITEMS];>>[STOCK_ITEMS]ID;[STOCK_ITEMS]ID) and does not require any type of relations between files.


Select Values

Second package called SelectValues allows user to select records from specified file without side effects for current process. Consider situation. User needs to prepare purchase back order report using his 4D based inventory system. It is necessary to filter out unwanted data. All systems I have seen apply from-to approach: for example, they allow to include in report suppliers from Apple Computer to Compaq, but not Apple, Canon and Compaq separately (user has to generate three separate reports or one big report with unwanted data). Report generation options may look like this:

Dialog shown above allow user to select individual suppliers, stock categories and stock items to be included in report. If "Filter out stock items" option is on, user can select stock items of specified categories, not from entire inventory. Here is how data (stock categories in our case) is displayed:

User can select all records pushing sum button, add to or omit from selection. Script attached to "Select Stock Categories" button consist of a few lines:

` Remember currently selected records.

CREATE SET([STOCK_CATEGS];"<>gUsedSet")

` Run SelectValues package.

If (SelectValues (>>[STOCK_CATEGS];>>[STOCK_CATEGS]ID))

` Sort and display user selection.

USE SET("<>gUserSet")

SORT SELECTION([STOCK_CATEGS];[STOCK_CATEGS]ID;>)

End if

SelectValues package entirely written in 4D and can use custom sorting procedure instead of default sorting without altering package itself.

PS. I am no longer use 4D since 1996. By my opinion, it is too overpriced, limited and slow. I have moved my databases to FileMaker Pro and planning to deploy open-source PostgreSQL database server in the nearest future.


MacGuruHQ and MacGuruHQ Logo

Copyright© 1996 - 2002 by Andrei Verovski. All right reserved. Content may not be copied in whole or in part, through electronic or other means, without the author's permission. MacGuru Logo (blue penguin) by Sergey Orehov.