Properties For Transaction Objects In Progress

ycherrs

New Member
Hey Guyzzzzzzz, need help here. What is the syntax to determine whether the transaction return no data? The scenario is this : Inside a loop, i want to check whether it returns set of data or not. See my syntax below.

FOR EACH table name
where tablename.field1 = parameter
and tablename.field2 = parameter NO-LOCK.

/* if fetches data = OK then
message "It contains data".
else
message "No data". */

END

Ive tried this syntax but it doesnt work....
if available tablename then
message "it contains data".
else
message "No data".

I want to know its transaction property instead.. like in oracle...
if it fetches no data you can code it like this:
NOTE: SQLCA is the transaction object...

if SQLCA.SQLCODE = 100 then (Meaning no data found)
MESSAGEBOX("Alert","NO Data Found."
else
MESSAGEBOX("OK","It Contains data.")
end if

Does anybody knows whats the equivalent of SQLCA.SQLCODE in PROGRESS?
OR LET ME PUT IT THIS WAY, HOW CAN I COULD
---------------------------------------------
DO WHILE SQLCA.SQLCODE <> 100

LOOP
---------------------------------------------
VERY SORRY IM QUITE NEW IN PROGRESS.. STILL ON THE PROCESS OF LEARNING.
THANKSSS GUYZZZZZZZZZ..

:=)
 
Hi

Basically if you getinside the for each loop youve got data. if the criteria for matching the records

where tablename.field1 = parameter
and tablename.field2 = parameter

doesn't match any records then you don't get inside the loop.
 
Re:

Hi.. thanks for your reply.I got it yesterday. what i did is this..

find first tablename
where tablename.field1 = parameter1
and tablename.field2 = parameter2 no-error.


if available tablename then
do:
for each tablename
where tablename.field1 = parameter1
and tablename.field2 = parameter2 no-lock.

so on.... and so forth....
end.


thanks....
 
Why would you do this? If you use a for each in Progress, thecodeinside the for each loop only gets executed if there isdataavailable... So, if you have a

for each tablename where....
<the code here only executes if there is data that matches the where criteria>
end.
 
Hi,

find first tablename
where tablename.field1 = parameter1
and tablename.field2 = parameter2 no-error.

remember one thing.. when u write a find or for command on a table, dont forget to put a no-lock or exclusive-lock based on what ur requirement is.

You dont want any locking problems in your program..
 
Logical

How PSC & Progress works.
If a statement is:
FOR EACH ... (criteria)
ONLY records matching the criteria with be put into the record buffer. Within your block you could have specific criteria queried.
You could FOR EACH wider level, and the simple query the records to narrow the level down a level. Place a IF statement and or a CASE to narrow the search down. ONLY records matching ALL he first FOR EACH will be placed into the buffer.
 
Back
Top