DISPLAY — Moves the values of fields or variables into the screen buffer and displays them (#1 in the figure)
PROMPT-FOR — Prompts the user for data and puts that data into the screen buffer (#2 in the figure)
ASSIGN — Moves data from the screen buffer to the record buffer (#3 in the figure)
UPDATE
UNLESS-HIDDENfield format-phrase WHEN expressionTEXT ( field format-phrase )field = expressionconstant AT n TO n^SPACE ( n )SKIP ( n )GO-ON ( key-label )frame-phraseediting-phraseNO-ERROR
UPDATE recordEXCEPT fieldframe-phraseNO-ERRORIn array fields, array elements with constant subscripts are handled as any other field. Array fields with no subscripts are expanded as though you entered the implicit elements. See the DISPLAY statement reference entry for information on how array fields with expressions as subscripts are handled.
UPDATE x[1] = "x".
UPDATE X = "X".Specifies one or more frame attributes for a field, variable, or expression. For more information on format-phrase, see the Format phrase reference entry.WHEN expressionUpdates the field only when expression has a value of TRUE. The expression is a field name, variable name, or expression whose value is logical.Table 63 lists the keys you can use within a TEXT field and their actions.
Table 63: Moves the cursor one position to the left and deletes the character at that position. If the cursor is at the beginning of a line, BACKSPACE moves the cursor to the end of the previous line. field = expressionIndicates that the value of field is determined by evaluating the expression rather than having it entered on the screen or from a file. In effect, an assignment statement is embedded in the UPDATE statement.constant AT nRepresents a constant value that you want to display in the frame. The n is the column in which you want to start the display.constant TO nRepresents a constant value that you want to display in the frame. The n is the column in which you want to end the display.
UPDATE^SPACE ( n )Identifies the number (n) of blank spaces to insert after the expression displays. The n can be 0. If the number of spaces you specify is more than the spaces left on the current line of the frame, the AVM starts a new line and discards any extra spaces. If you do not use this option or do not use n, the AVM inserts one space between items in the frame.SKIP ( n )Identifies the number (n) of blank lines to insert after the expression is displayed. The n can be 0. If you do not use this option, the AVM does not skip a line between expressions unless they do not fit on one line. If you use the SKIP option, but do not specify n or if n is 0, the AVM starts a new line unless it is already at the beginning of a new line.GO-ON ( keylabel . . . )Tells the AVM to take the GO action when the user presses any of the keys listed. You list keys in addition to keys that perform the GO action by default or because of ON statements. For example, if you want the AVM to execute the GO action when the user presses F1, use the statement GO-ON(F1). If you list more than one key, separate them with spaces, not commas.Specifies the layout and processing properties of a frame. For more information on frame-phrase, see the Frame phrase reference entry.Identifies processing to take place as each keystroke is entered. This is the syntax for editing-phrase:
statement ENDLABEL : EDITING :Suppresses ABL errors or error messages that would otherwise occur and diverts them to the ERROR-STATUS system handle. If an error occurs, the action of the statement is not done and execution continues with the next statement. If the statement fails, any persistent side-effects of the statement are backed out. If the statement includes an expression that contains other executable elements, like methods, the work performed by these elements may or may not be done, depending on the order the AVM resolves the expression elements and the occurrence of the error.
Check if the ERROR-STATUS:NUM-MESSAGES attribute is greater than zero to see if the AVM generated error messages. ABL handle methods used in a block without a CATCH end block treat errors as warnings and do not raise ERROR, do not set the ERROR-STATUS:ERROR attribute, but do add messages to the ERROR-STATUS system handle. Therefore, this test is the better test for code using handle methods without CATCH end blocks. ABL handle methods used in a block with a CATCH end block raise ERROR and add messages to the error object generated by the AVM. In this case, the AVM does not update the ERROR-STATUS system handle.
Use ERROR-STATUS:GET-MESSAGE( message-num ) to retrieve a particular message, where message-num is 1 for the first message.To update a record in a table defined for multiple databases, you must qualify the record’s table name with the database name. See the Record phrase reference entry for more information.EXCEPT fieldThe following procedure lets you update the Name, Address, City, State, and Country for each Customer record in the database:
FOR EACH Customer:UPDATE Customer.Name Customer.Address Customer.City Customer.StateCustomer.Country.
END.The r-updat2.p procedure reads each Customer record and lets you update the Name and CreditLimit fields. The VALIDATE option on the first UPDATE statement ensures that you enter a CreditLimit value that is less than 500000. The HELP option displays a message to that effect.
FOR EACH Customer:UPDATE Customer.Name
Customer.CreditLimit VALIDATE(Customer.CreditLimit < 500000, "Too high")
HELP "Enter CreditLimit < 500000".
FOR EACH Order OF Customer:DISPLAY Order.OrderNum.UPDATE Order.PromiseDate Order.ShipDate VALIDATE(Order.ShipDate > TODAY,"Ship date must be later than today").
END.END.The second FOR EACH block reads every Order belonging to the Customer, displays the OrderNum field, and lets you update the PromiseDate and ShipDate fields. The VALIDATE option ensures that you enter a ship date value that is after today’s date.
REPEAT:PROMPT-FOR Customer.CustNum.FIND Customer USING Customer.CustNum.UPDATE Customer.Name Customer.Address Customer.City Customer.StateCustomer.Country WITH 1 COLUMN 1 DOWN.
END.
If any field is a field in a database record, the UPDATE statement upgrades the record lock condition to EXCLUSIVE-LOCK before updating the record.
If any field is part of a record retrieved with a field list, the UPDATE statement rereads the complete record before updating it. If any field is not part of the field list (or related fields) fetched with the record, or if record includes such unfetched fields, the AVM raises the ERROR condition before the UPDATE statement accepts input. This is because the UPDATE attempts to display the fields before it rereads the record.
The UPDATE statement is not equivalent to a combination of the DISPLAY and SET statements.
REPEAT:PROMPT-FOR Customer.CustNum.FIND Customer USING Customer.CustNum.UPDATE Customer.CreditLimit.END.
REPEAT:PROMPT-FOR Customer.CustNum.FIND Customer USING Customer.CustNum.DISPLAY Customer.CreditLimit.DO ON ERROR UNDO, RETRY:SET Customer.CreditLimit.END.END.
If you use a single qualified identifier with the UPDATE statement, the compiler first interprets the reference as dbname.tablename. If the compiler cannot resolve the reference as dbname.tablename, it tries to resolve it as tablename.fieldname.
When updating fields, you must use table names that are different from field names to avoid ambiguous references. See the Record phrase reference entry for more information.
In Progress Version 7 and above, when you execute UPDATE with a specific or implied GO-ON(keylabel) from a called program, the AVM generates an error message (4123). This is due to an incompatibility in focus. The workaround is to add a VIEW FRAME statement after the call to the subprocedure such that the VIEW FRAME is the first statement executed on return from the called procedure.
In the context of the .NET blocking method, System.Windows.Forms.Application:Run( ), if you directly or indirectly execute the UPDATE statement while displaying a non-modal ABL window, in certain contexts (such as within a user-defined function or non-VOID method) this statement execution raises the STOP condition. For more information on the .NET Application:Run( ), method, see the reference entry for the WAIT-FOR statement (.NET and ABL).
© 2013 Progress Software Corporation and/or its subsidiaries or affiliates. |