how to create buffer of buffer

nate100

Member
Hello,
The following code does not seem to work:

def buffer buff1 for sod_det.
def buffer buff2 for buff1.

What I need to do is to iterate through a buffer with another buffer.

Thank you.
 
def buffer buff1 for sod_det.
def buffer buff2 for sod_det.


A buffer can only be defined on the table it relates to, but you can have multiple ones.


What are you actually trying to do? Because I suspect you might not understand what a buffer is.
 
Hello,
Thank you very much for your response:
What I am trying to do is to do a break by end user and service code.

Once I get those contracts, I need to then make sure they are not locked.
I have the following code:
def buffer saddt for sad_det.
def buffer saddet_buff for saddt. /* this does not work obviously */

for each sad_det
where sad_domain = global_domain
and sad_prefix begins "R"
break by sad_eu_nbr
by sad_sv_code:
if first-of(sad_sv_code) /* I need to get contracts only for that end user service type combination */
then do:

/* I am now only looping for specific end user service code */

for each saddt no-lock
where saddt.sad_domain = global_domain
and saddt.sad_eu_nbr = sad_det.sad_eu_nbr
and saddt.sad_prefix = sad_det.sad_prefix
and saddt.sad_sv_code = sad_det.sad_sv_code
and saddt.sad_ui_line ne 0:


find first saddet_buff /* I need to check that if the record we are on is locked or not. I am having problem with this buffer as it should be of saddt * */
where saddet_buff.sad_domain = sad_det.sad_domain
and saddet_buff.sad_nbr = sad_det.sad_nbr
and saddet_buff.sad_eu_nbr = sad_det.sad_eu_nbr
and saddet_buff.sad_prefix = sad_det.sad_prefix
and saddet_buff.sad_sv_code = sad_det.sad_sv_code
and saddet_buff.sad_ui_line = sad_det.sad_ui_line
and saddet_buff.sad__log01 = sad_det.sad__log0
exclusive-lock no-wait no-error.
if locked(saddet_buff)
then do:
<msg>
end.
end. /* if first -of */
end. /* for each sad_det */
 
if you are just trying to find locked record/s for that end user + service type,
you may try this:

def buffer saddet1 for sad_det.
def buffer saddet2 for sad_det.
def var currow as rowid.

for each sad_det no-lock
where ...
by...
if first-of(..) then
for each saddet1 no-lock where ... :
currow = rowid(saddet1).
find saddet2 where rowid(saddet2)=currow no-error no-wait.
if locked saddet2 then ...
 
Please don't get mad at me, but should make yourself familiar with the concept of record buffers, be they for database tables or temp-tables. It's a good thing to know what you're really doing when you reference a record buffer, how and when the records get read into it, how and when updates are saved away to the database or the temp-table and where you're transaction scope is in between all of this.

In other words you should make yourself familiar with buffers, buffer and transaction scope in order to write "good" software against a Progress database with the Progress 4GL.

All of this information can be found in the documentation that comes with the product.

Heavy Regards, RealHeavyDude.
 
Back
Top