Set, Update and Prompt-for

Posted by vignesh kumar on 13-Mar-2016 06:52

Hi all,

Could you please explain the difference between SET, UPDATE and PROMPT-FOR ?

In OE documentation am not able to understand clearly. can you please explain with an example.

Posted by Bill Wood on 13-Mar-2016 09:02

All of the items in the Data Access Statements can apply to fields retrieved from a database. They represent different aspects, primitive operations, or combinations of primitives.

I think UPDATE is clear to you. SET can be used, in one example, for a new record where there is current record values you want to update (so you don't need the DISPLAY from the record buffer to the screen buffer. ). A common use of PROMPT-FOR, by itself; is to just get user input. (Eg to "prompt for" a number of years to create a recover or for "OK to continue?"). But remember these all combine into the more complex operations.

You can think of it a little like this:

SET is a combination of PROMPT-FOR and ASSIGN

UPDATE is a combination of DISPLAY, PROMPT-FOR and ASSIGN.

That means, SET will display a blank field to enter value.

but UPDATE will display the existing value in the variable or field and allow user to modify it.

It would help to understand more about your specific use case and version or OpenEdge you are using. In particular is this a Character mode application, a procedural GUI application, something written in the UIB or AppBuilder for event-driven UI, or what? (What version of the compiler is useful as well).

Sent from Bill's iPhone.

Posted by Bill Wood on 13-Mar-2016 07:23

The best section in the documentation to describe this is the section on Data Handling Statements (in the ABL reference).  This is online at:

documentation.progress.com/.../

This section has a nice chart that shows the relegation between the different data handling statements and how they move data to and from:

- the user

- the Screen Buffer

- the Record Buffer

- the database

PROMPT-FOR, SET, and UPDATE all ask the user for input but:

- PROMPT-FOR just asks the user for input and store the sesult in the Screen Buffer

- SET does this as well but also assigns the vale to the record buffer itself

- UPDATE does the same as SET but first populates the screen buffer with the current value of the record buffer

I would say that 9 times out of 10, in traditional Character or GUI programs where you are collectinginout one FRAME at a time, you are going to use UPDATE instead of SET or PROMPT-FOR.    (Note that in Event Driven programming it is actually more common to use DISPLAY, ENABLE and ASSIGN as "single-step" primitive actions because in this model the user has access to many FRAMES and ABL WINDOWS simultaneously and the programmer Iogen wants more fine grained control on when each primative is called.  

Good luck.  BTW there are some good courses on the basics of ABL available (see www.progress.com/.../education)

All Replies

Posted by Bill Wood on 13-Mar-2016 07:23

The best section in the documentation to describe this is the section on Data Handling Statements (in the ABL reference).  This is online at:

documentation.progress.com/.../

This section has a nice chart that shows the relegation between the different data handling statements and how they move data to and from:

- the user

- the Screen Buffer

- the Record Buffer

- the database

PROMPT-FOR, SET, and UPDATE all ask the user for input but:

- PROMPT-FOR just asks the user for input and store the sesult in the Screen Buffer

- SET does this as well but also assigns the vale to the record buffer itself

- UPDATE does the same as SET but first populates the screen buffer with the current value of the record buffer

I would say that 9 times out of 10, in traditional Character or GUI programs where you are collectinginout one FRAME at a time, you are going to use UPDATE instead of SET or PROMPT-FOR.    (Note that in Event Driven programming it is actually more common to use DISPLAY, ENABLE and ASSIGN as "single-step" primitive actions because in this model the user has access to many FRAMES and ABL WINDOWS simultaneously and the programmer Iogen wants more fine grained control on when each primative is called.  

Good luck.  BTW there are some good courses on the basics of ABL available (see www.progress.com/.../education)

Posted by vignesh kumar on 13-Mar-2016 07:40

Thanks for your response.

Prompt-for and Set values will be available in database or not? as the values are in screen or Record buffer only.

And also please explain the conditions when we have to use set, prompt or update in programs appropriately?

Posted by Bill Wood on 13-Mar-2016 09:02

All of the items in the Data Access Statements can apply to fields retrieved from a database. They represent different aspects, primitive operations, or combinations of primitives.

I think UPDATE is clear to you. SET can be used, in one example, for a new record where there is current record values you want to update (so you don't need the DISPLAY from the record buffer to the screen buffer. ). A common use of PROMPT-FOR, by itself; is to just get user input. (Eg to "prompt for" a number of years to create a recover or for "OK to continue?"). But remember these all combine into the more complex operations.

You can think of it a little like this:

SET is a combination of PROMPT-FOR and ASSIGN

UPDATE is a combination of DISPLAY, PROMPT-FOR and ASSIGN.

That means, SET will display a blank field to enter value.

but UPDATE will display the existing value in the variable or field and allow user to modify it.

It would help to understand more about your specific use case and version or OpenEdge you are using. In particular is this a Character mode application, a procedural GUI application, something written in the UIB or AppBuilder for event-driven UI, or what? (What version of the compiler is useful as well).

Sent from Bill's iPhone.

Posted by Laura Stern on 14-Mar-2016 09:13

Just be aware that in a modern GUI application you would probably not be using any of these statements.  You would set up a classic ABL frame with enabled widgets or a .NET form and go into a WAIT-FOR statement.  There are various ways to prefill all the fields which I won't get into right now.  UPDATE/PROMPT-FOR and SET were really designed for character mode apps and are still useful for playing around, doing admin activities on the database and perhaps doing quick prototypes.

This thread is closed