home   about us   contact us  
Distribtution
Financial
Appx
News
Search site for:




Setting Environment Variables

A little known feature of Appx is the ability to set environment variables from the command line. Just prefix the variable with 2 dashes as follows:
appx --APPX_SQL_LOG=c:\logs\appx.log --APPX_CMD_LOG=0xFFFFFFFF

This will set APPX_SQL_LOG and APPX_CMD_LOG for the duration of this session only.



Synchronized Lists/Displays

Wouldn't it be nice if you could have APPX automatically display information relating to a parent record when that parent record was selected in a scrolling display? For example, when a user selects a particular customer, have APPX automatically display all orders for that customer in another scrolling popup box, without the operator having to press an Option key. In some environments, this is called a 'synchronized list', (i.e. the records in the child window are automatically synchronized to whatever parent record is active). You can do this in APPX using the following technique. First, define an INPUT process to display the information you want to show from the child records. This can only contain one frame, which can be scrolling, or not, depending on your needs. In the Additional Attributes section of the Frame, set the END DISPOSITION to HOLD. This tells APPX to leave this image on the screen even when the child process is ended. Also set the Display Only attribute to "Y" on the frame. Define the Image and put whatever fields you want on the screen. In the parent process attach this new Input process as an optional child with the appropriate constraints and place code similar to the following in the PRE-DISPLAY event point of the frame:

	IF  --- INTERACTIVE PHASE NE DATA SCROLL
	AND --- INTERACTIVE PHASE NE KEY ENTRY
T 	BEG AT 1EX ORDER1 IN 1EX VENDOR NO
T 	END AT 1EX ORDER1 IN 1EX VENDOR NO
T 	READNEXT 1EX ORDER1 HOLD 0 FAIL 0 KEY IS ORDER1 VENDOR NO
TT 	SET --- OPTION = USER 1
All this code does is automatically invoke the child process under the right circumstances. We check the INTERACTIVE PHASE to make sure APPX is not filling a scrolling window, or prompting for a key. The BEG AT/END AT/READNEXT are there so we don't unnecessarily invoke the child. If everything is true, we set OPTION to USER 1 (or whatever optional child number you used when you attached the child to the image), and APPX will automatically run the child process for us. Since our child only contains a display only frame, APPX will end the process as soon as all the records as displayed, and since the END DISPOSITION on the childs' frame is set to HOLD, APPX will leave the records on the users screen. If the user moves to a parent record without any children, APPX magically clears the old child data from the screen.

If there are more child records that will fit in the childs scrolling window, you can also set SCROLL TO END to "Y" in the child to cause APPX to read all the records and leave the last group on the screen, if this is appropriate for your requirements.

NOTE: This technique needs some fine tuning if you are running 4.2. Under 4.2, APPX will rerun the PRE-DISPLAY event point after executing the Optional child, resulting in an infinite loop. You will need to keep track of whether you have run the Optional Child for the current parent or not.



Suggest a Value in Drop Down List

In the data dictionary for alpha fields, we can enter a list of valid values. Once we do that, a new field appears on the 'Additional Attributes' screen - 'Req Table Value?'. This is a Yes/No field and the default behaviour is Yes. This means that the user must choose a value from the list. If we set this field to "N", then the user is not restricted to the values on this list. They will still get a drop down list of choices but they can ignore the choices and enter something else instead.


Select a Record & Run Optional Child with one click

It would be useful if we could put a button on a scrolling display and allow the user to click it to fire the option for that record.

The problem with this approach is that the currently selected record does not change if they click the button on a different record. Any constraints will use the original record, not the one they clicked on.

What we want is a way to move the cursor to the record the user clicked on, as well as fire the option. Then we can use AT FIELD to see if they moved off the current record and take appropriate action. Fortunately, USER 251 to USER 254 are special options that will move the cursor to the selected record (as if the user had pressed the cursor keys) first and then fire the option.

Since Appx moves the cursor then fires the option, we can put the following code in Option Intercept to detect this:

	AT FIELD (AT APPEARANCE # )
F 	IF 	--- OPTION GE USER 251
F 	AND 	--- OPTION LE USER 254
FT 	PUSH 	--- OPTION FIELD
FT 	SET 	--- OPTION = RETURN
	GOSUB 	DMO ENHANCED SCROLLING BEHAVIOUR
If AT FIELD is false and OPTION is between USER 251 – USER 254, we know they clicked the button on some other record. In that case, save the current value of OPTION (via the PUSH statement) and set it to RETURN. The GOSUB DMO ENHANCED SCROLLING BEHAVIOUR will take care of selecting the new record for us.

Then, in Pre-Display, we just add:

	IF 	--- INTERACTIVE PHASE NE DATA SCROLL
T 	POP 	--- OPTION FIELD
If there is anything in the stack for --- OPTION, this will retrieve it. Appx will then process --- OPTION as if the user had clicked the button. In this example, the option will be set to USER 251 and now the optional child will run for the newly selected record. If the stack is empty, the POP statement will not do anything.


String Comparisons with Regular Expressions

You can use the RI/RS tests to quickly determine if a string begins with or ends with a certain string.

To check if a field begins with a string, just preface the string with the caret symbol:

	IF --- TEMP 80 RI ^ABC
T 	true if string begins with ABC/abc/AbC/aBC/ etc.
To check if a field ends with a certain string, append $ to the end of the string:

	IF --- TEMP 80 RI ABC$
T 	true if string ends with ABC/abc/AbC/aBC/ etc.


Do you have a tip you want to pass on? Contact Us.


« Return



© Copyright 2009 - C.A.N.S.Y.S. West Limited All Rights Reserved