Can I make like temp-tables with different default field values?

freak

Member
Code:
DEFINE TEMP-TABLE test 
    FIELD f1 AS CHAR
    FIELD f2 AS CHAR
    FIELD f3 AS CHAR INIT "A".


DEFINE TEMP-TABLE test2 LIKE test
    FIELD f3 AS CHAR INIT "B".
I want different default field values for several temp-tables. This doesn't compile but is there a way to accomplish what I am trying do?
 

jmac13

Member
well its not working cause ur trying to define a field that already exists in temp-table test2. Why do want to do this anyway?
 

freak

Member
I know. It was just a demonstration of what I wanted to do. I want to do it so temp-table test2 has a different default value for field f3.
 

Cringer

ProgressTalk.com Moderator
Staff member
Just define the field without a default value and ensure you set it correctly in the program. Or

Code:
DEFINE TEMP-TABLE template      
  FIELD f1 AS CHAR     
  FIELD f2 AS CHAR.

DEFINE TEMP-TABLE test LIKE template   
  FIELD f3 AS CHAR INIT "A".

DEFINE TEMP-TABLE test2 LIKE template   
  FIELD f3 AS CHAR INIT "B".
 

tamhas

ProgressTalk.com Sponsor
LIKE is a good candidate for the keyword forget list.

I am pretty sure that if you described why you want to do this, I would object.
 

tamhas

ProgressTalk.com Sponsor
That doesn't really tell me anything, but one might start by asking why there is a different *data structure* for describing something which is identical in every respect except for initial values. At most, initial values for temp-tables or database tables are for default values in case nothing is assigned. This color or that color is assigning a specific state. Why is there any initial value and not just an assignment of the relevant state?

I.e., what are you accomplishing with multiple temp-tables that you couldn't accomplish with one?
 
Top