# Another Trigger - @key

There is a relatively simple command called @key, that lets you do things with processing while you are sitting at the "Enter Selection" prompt on a filePro screen. This feature lets you execute processing when the user presses a specified key. These keys are similar to the keys you see at the bottom of the screen like H=Hardcopy, F=Form, U=Update and so forth.

For demonstration purposes, Let's say you have a screen that is so full of information there is no room to put the creation date and created by system maintained fields anywhere on it. You could use the following @key to display them. Or maybe you don't like seeing this information ALL the time. We will use @keyC for this example but just about any character key on the keyboard would do:

If:
Then: end
@keyC If:
Then: show "@Created On"<@cd<"Created By"<@cb
If:
Then: end

When the operator presses the C key, this @key processing will display the creation date and created by fields filePro stores on each record.

Note 1) Any processing above the @key should not fall through accidentally to the @key processing. This example shows the "end" command just above this @key processing. For now, put all your @key processing at the very end of your main input table, and before each @key you should have an "end" statement.

Note 2) @key processing must have a definite ending line, a place where the processing stops and the @key is over. For now, until you learn more about them, be sure there is an "end" statement to stop the @key processing when it should stop.

You don't have a watch, you are deeply involved with your filePro records but are too lazy to go and look at a clock. How about showing the time when you hit @keyT, enter the following:

If:
Then: end
@keyT If:
Then: show "@The time is"<@tm
If:
Then: end

You can use an @key to do fast custom updating of flags in filePro mailing lists. Let's say you have a file that you want someone to use as a "prospect calling list". You know all the people in the file and want to select a group of them for the person to call. The selection criteria is totally subjective so you want to look at each record and make up your mind whether to mark it for calling or not. Do the following:

Go into Define Files on the prospect file, add a 1 character field to the file, give it an edit type of "allup". Let's use field 22 as an example.

Go into Define Screens and put this field on your screen somewhere.

Go into Define Processing tables and add this little table to the end of your input table:

If:
Then: end
@keyY If: 22 eq ""
Then: 22 = "Y";display;end
If: 22 eq "Y"
Then: 22="";display;end

This now becomes a toggling switch for you to use in marking the records. If you want to mark the record, press Y. (Remember your cursor must be blinking at the Enter Selection prompt) If you want to deselect the record, press the Y again and the field is cleared. You don't have to go into Update mode cursor down to the right field enter the right thing and then press ESC ESC. It's a real time saver, you can arrow down through the records marking and unmarking as you go.

You could then build another @key like @keyC which would do the same thing but with letter C. The person doing the calling could mark everyone he called with a C so they wouldn't be called again by accident. When the file is empty of Y's and full of C's start all over again with other letters or different classifications.

You can have an @key zoom you into another file temporarily with the following:

If:
Then: end
@keyZ If:
Then: system "/appl/fp/rclerk otherfile -s1"
If:
Then: end

This would put you into "otherfile" on screen 1. You can use this file as long as you want, when you exit this file, you are back on the record in the first file where you pressed the @keyZ.

NOTE: The @keyX letter like this X do not have to be upper case, I do that just as a matter of style. It makes them easier to read than something like @keyy, which would work just as well as @keyY.

You can also use the punctuation symbols on the keyboard, as in @key+ and @key- or @key?

Trigger Processing_tables (INPUT)

There are several @trigger types of processing available that are coded on the INPUT processing table. The major types are @when leaving/entering, @Key, @entsel, @menu, @whp, @wuk. There are others.

@When Leaving/Entering Field Processing_tables

When-field processing is done when the cursor enters or exits a field. It is used when the processing should be done on a field-by-field basis.

When-field processing is performed immediately as the user is entering data and moving from field to field, rather than when the user has finished entering data and finally presses ESC ESC.

Common Uses

Displaying messages when the user enters or exits a field.

Preventing the user from leaving a field blank or with unwanted data in it.

Filling in looked up data immediately.