Chapter 8: Client
Programming by Example: PixieExcel
PixieExcel is an example of a visual
front-end for a MV system, in this case from within MS Excel, when connecting to
MV system via PixieWeb. PixieExcel needs the supplied PICKBASIC
program, "PX.BACKSRV" loaded
compiled and catalogued in your PICK-etc Server. Ref Chapter 1
How do I know if this
"backserver" is present? Just try
running PixieExcel, if no "backserver", PWExcel will give you that
message.
Source Code and product
status of PixieExcel PixieExcel is sold
as a single-user client product. This almost identical version
(PixieExcelW.xls) to work with PixieWeb is supplied as source code and
comes with the same licensing arrangement as PixieWeb: ie server/site
licensing with unlimited client installations for use with the nominated
server. So regard this PixieExcel as part of the bulk-buy bonus deal of
the PixieWeb product.
To view the source
code, select Menu:Tools --> Macros --> Visual Basic Editor
In the
following commentary, each Step from the user guide is followed by notes on
the relevant source code.
Step 1 - Connect to MV
Open "PixieExcelW.xls" Howto: > * Start
Button:Programs --> PixieWeb --> PWExcel * OR WIndows Explorer --> C:\Program
Files\PixieWeb\PWExcel\PWExcel.xls * OR MS
Excel --> C:\Program Files\PixieWeb\PWExcel\PWExcel.xls
Click on
"PICKetc_QUERY" button from within spreadsheet as this starts the MV system
connection process.
Step 2 - Login to
MV system
The following screen is displayed after clicking
"PICKetc_QUERY" button.
Enter UserName - PICKetc user-name.
Enter Password - PICKetc password.
Server, Port and Timeout are remembered from previous
session. Changes required to these settings when you need to point Excel at
different server or port. Timeout can be increased if system login response is
slow.
The "First Setup/Adv Config" button will be used by
the Installer or Systems Administrator if unusual Login configurations need to
be set-up prior to the first connection attempt. This procedure will usually
only need to done once. The image below shows
what you see when "First Setup/Adv Config" is clicked. The table sets
out the steps needed to automate Login to PICKetc. The Left-hand-fields show login steps, as you would enter
them in a traditional terminal session. The
right-hand-fields contain text to identify successful expected
responses. This is usually a colon prompt or other text from near the
end of the usual PICKetc response message. {USERID} and {PASSWORD} are placeholders ie
variables.
Click Login to proceed. Click Cancel to exit back to
.xls spreadsheet.
Step 3 - Select
Target Data
The following screen is displayed after a successful
login.
Accounts that the User are permitted to access are
displayed in column 2a. Select (highlight)
appropriate account and click "Next" (between columns 2a and 2b).
Select appropriate file from displayed list. Click
"Next" between columns 2b and 2c.
Select appropriate query from displayed list. Only
queries relating to the selected file will appear in column 2c. Options exist
to: RUN a selected query, EDIT a selected query, create a NEW query, or exit
back to spreadsheet.
Step 4 - Display
Target Data
Results of the selected query are displayed on the
spreadsheet similar to the screen following. The data can now be used in any
manner that is available to MS Excel. Please note that data from the
spreadsheet cannot be written back to the source MV file with PixieExcel.
Other PixieWare software products may be employed for this purpose.
The query can be modified and run again.
When running large queries, a line counter runs in
the top-right-hand corner of the form. If your query is taking too long
(eg "Oops, I didn't mean to download that file with a million items!") then
the "Run Query" button has turned into a "STOP" button for you to click.
We recommend you use SELECT ... WITH against large files to download a
subset of interest.
Step 5 - Edit
a Query
Parameters for a selected query are displayed in the
following example template screen.
The query can be modified, run again and saved.
Variations on a theme can be saved under different names.
Four parameters are available: Query Name, SELECT
statement, LIST statement, ITEMLIST selection (via check boxes). The ITEMLIST
is a graphical way of building and editing the LIST statement.
The SELECT and LIST statements can be used as if
being executed from TCL. . Note that sorting,
selection and ordering using BY and WITH need to be handled in SELECT or
SSELECT. The LIST statement is a plain list of
required fields. This means for example that there is
no SORT offered here. Use SSELECT and LIST instead. eg SSELECT CUST BY Contacts / LIST CUST Name Contacts Fax
Tel
A new query starts with a blank template. The query
is associated with the selected file and will be subsequently displayed when
that file is again selected. The query is stored as
an "X" item in the dictionary of the selected file.