Confused with the way why Progress acts so...

Hi Everybody,
Kindly let me know why does the result of the below code is empty? It seems in all the below example if i create only one record with default value assigned to the INDEXed field than i am not getting the record displayed when i use BREAK BY option in FOR...EACH.

I am not sure if i am confusing myself or Progress confuses me...

Example 1:
DEF TEMP-TABLE tt NO-UNDO
FIELD a AS INT
FIELD b AS INT
INDEX a a .


CREATE tt.
tt.a = 0.
tt.b = 2.


FOR EACH tt BREAK BY tt.a:
DISP tt.
END.

Example 2:
DEF TEMP-TABLE tt NO-UNDO
FIELD a AS LOGICAL
FIELD b AS INT
INDEX a a .


CREATE tt.
tt.a = NO.
tt.b = 2.


FOR EACH tt BREAK BY tt.b:
DISP tt.
END.

Example 3:
DEF TEMP-TABLE tt NO-UNDO
FIELD a AS CHAR
FIELD b AS INT
INDEX a a .


CREATE tt.
tt.a = "".
tt.b = 2.


FOR EACH tt BREAK BY tt.b:
DISP tt.
END.

Sorry for some very lengthy quotes. Thanks in advance.
 
There was a thread somewhere recently, but I can't remember whether it was here, PEG, or PSDN which talked about what I think is this behavior. The issue is not the break by, but the fact that you have added one record and it is not yet released. I *think* that putting a RELEASE tt after the create and assign might do the job. There was also something in that thread about whether the index assignment was the default value and it behaving differently if it wasn't, so you could play with that too.

While I know this is just a little example, myself I would strongly scope the create as well. I.e., at the least, wrap the create with a DO FOR tt: END. block. You might experiment a bit and report back for our education.
 
I *think* that putting a RELEASE tt after the create and assign might do the job.


The release might be a good start. I had a very nasty C error once in a character environment. Debugging lead to a procedure where some tt were created. The solution was to RELEASE the record after create assign. Never knew why this happened. Anyway the problem was solved.
 
Hi Tom,
The reason why i insist on BREAK-BY is that in the same query if i use BY it displays the record, or if i remove the index then it works fine. The problem raises only when in the below scenario;
1) INDEX field and the field provided in BREAK-BY are one and the same
2) If more than 1 record is created it works fine
3) If i create this one record with other than the default value it works fine

So i am not sure if the issue is relating to create and releasing the record. Let me check and make sure. If any updates kindly let me know... :confused:
 
really suprised to see such things.:lol:

Is this due to index or Defalut values or any other thing.

really good qustion.
 
Back
Top