Easy to Create, Easy to Change - Easy to use!

Command::

input using



Parameters


Returns/Result


Examples


Reference

input using

Type

Processing Command

Purpose

The input using command provides all the facilities of record entry but allows DQL to process records before they are entered into the database. It can be used at any point in a procedure.

Syntax

input using TABLENAME into "TEMPFORM" via form EXISTINGFORM .

In the input using command syntax, FORMNAME is the name of a table. TEMPFORM is the name DataEase uses to reference an input using record. You can assign any name you want for this purpose except the name of a form in the same application. The first time that the TEMPFORM name is specified in the script, it must be enclosed in quotation marks.

The optional ?via form EXISTINGFORM? displays the form document EXISTINGFORM, which is the name of an existing form that uses as its main table the table specified by TABLENAME.

If no form name is specified, DataEase displays the form that has the same name as the table, usually the form that defines the table.

There is no limit to the number of input using commands you can use in a script; however, each DataEase form must be assigned a unique TEMPFORM in the input using statement.

Usage

The input using command tells DataEase to display a specified record entry form. When the specified form is displayed, you can either enter or modify a record (in Form View), or scroll through the form (in Form or Table View) and select any existing record. You can also use theGoto>>Related Form menu option (or F10 key) to view records in related forms.

When you execute a processing action (e.g., File>>Close, Edit>>Save As New Record), the input record is copied into memory and a number that corresponds to the processing key is stored in the current status variable. DataEase then resumes processing the procedure, using the input using record data just like values entered in a Data-entry form. The current status value can be used to control subsequent processing. The table below summarizes the current status values returned by each processing action:

 

 

This

Menu Selection

Performs

This Action

And Returns

This Value

 

File>>Close

Close the active document

1

Edit>>Save As New Record

Save a new record

2

Edit>>Save

Modify an existing record

3

Edit>>Delete

Delete a record

4

 

 

Like a Data-entry form, the input using command is used to enter data for use in a procedure (rather than to permanently store the data in a table in the database). Unlike a Data-entry form, however, more than one input using statement can be used to enter data at any point during a procedure.

The input using command can only hold one record in memory at a time for a given TEMPFORM name. Therefore, if you want to save the contents of an input using record, you must use the enter a record command in the script to save the current record before processing another. Example 2 demonstrates the use of the input using command and current status variable within a loop to process multiple records.

 

Because input using can only hold one record in memory, the form must be displayed in Form View when a processing key is pressed. Table View is used for selection purposes only.

Example 1

input using MEMBERS into "TEMPMEMBER" .

for RESERVATIONS with ( MEMBER ID =

TEMPMEMBER MEMBER ID) ;

list records

RESERVATION ID ;

TOTAL DUE ;

DATE .

end

 

This script tells DataEase: (1) Display the MEMBERS form, (2) when the user selects a specific MEMBERS record and presses F2, store that record in memory (using the name TEMPMEMBER to reference it, (3) find all the RESERVATIONS records with the same MEMBER ID as the MEMBER ID in the TEMPMEMBER record, and (4) for each related reservation, list the RESERVATION ID, the TOTAL DUE, and the RESERVATION DATE. The output from this script might look as follows:

 

 

Reservation ID

Total Due

Reservation Date

00164

$2780.00

08/17/92

00312

$3150.00

04/30/93

00515

$2942.00

12/20/93

 

Example 2

while current status not = 1 do

input using MEMBERS into "TEMPMEMBER" .

case ( current status )

value 1 : exit .

value 2 : enter a record in MEMBERS

copy all from TEMPMEMBER .

value 3 : modify records in MEMBERS with

( MEMBER ID = TEMPMEMBER MEMBER ID)

copy all from TEMPMEMBER .

value 4 : delete records in MEMBERS with

( MEMBER ID = TEMPMEMBER MEMBER ID) .

end

end

 

The script in Example 2 tells DataEase: (1) Display the MEMBERS form, (2) each time the operator enters a record and executes a processing action (e.g., Edit>>Delete), check the value of the current status variable. If current status =1 (the user chose File>>Close when the input using record was on the screen), stop script processing without entering a record in the MEMBERS table and close the procedure. If current status = 2 (the user chose Edit>>Save As New Record when the input using record was on the screen), copy the input using record into the MEMBERS table.

If current status = 3, (the user chose Edit>>Save when the input using record was on the screen), modify the record in the MEMBERS table with a MEMBER ID (a Unique field) that is the same as the MEMBER ID on the input using record. If current status = 4, (the user choseEdit>>Delete when the input using record was on the screen), delete the record in the MEMBERS table with a MEMBER ID (a Unique field) that is the same as the MEMBER ID on the input using record, and (3) display the MEMBERS form again so the user can enter, modify, or delete another record.

Example 3

while current status not = 1 do

input using MEMBERS into "TEMPMEMBER" .

case ( current status )

value 1 : exit .

value 2 : if TEMPMEMBER MEMBER ID <= 20000 then

enter a record in MEMBERS

copy all from TEMPMEMBER .

else

message " Invalid ID. Re-enter the record. " .

end

others : message " You are not authorized to

modify or delete records. " .

end

end

 

This script tells DataEase: (1) Display the MEMBERS form, (2) each time the user enters a record and presses a processing key, check the value of the 

See Also


On the forum about input using

On the blog about input using