添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
深沉的野马  ·  JavaIO流 ...·  昨天    · 
捣蛋的牙膏  ·  java ...·  昨天    · 
霸气的跑步机  ·  Strings with ...·  昨天    · 
谦和的沙滩裤  ·  主题配置 | ...·  昨天    · 
被表白的针织衫  ·  Amazon.com·  7 月前    · 
活泼的松鼠  ·  [专项] ...·  12 月前    · 
Hi all,

I want to declare a multi-dimensional array of constant records as a constant:

type
TTMD_Type = (
tmdCliMemo,
tmdRezMemo,
tmdTermMemo
);

TTifRelDef = record
RelationType: String;
TableName: String;
KeyField: String;
end;

const
TifRelDefs: Array[TTMD_Type] of Array of TTifRelDef = (
???
);

With each value of TTMD_Type I want to access another array containing the
records.
I tried replacing the ???-line with this text:

( // Array for tmdCliMemo
(RelationType: 'RECIPIENT', TableName: 'CLIENTEN', KeyField:
'ID_CLIENT'),
(RelationType: 'SENDER', TableName: 'MITARBEITER', KeyField:
'ID_MITARBEITER')
),
( // Array for tmdRezMemo
(RelationType: 'SUBJECT', TableName: 'CLIENTEN', KeyField: 'ID_CLIENT'),
(RelationType: 'SUBJECT', TableName: 'REZEPTE', KeyField: 'ID_REZEPT')
),
( // Array for tmdTermMemo
(RelationType: 'SUBJECT', TableName: 'TERMINE', KeyField: 'ID_TERMIN')
)

but it didn't work (undeclared identifier: 'RelationType'). Can anybody
help me, please ?
Thanks,
Markuss


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get 128 Bit SSL Encryption!
http://us.click.yahoo.com/xaxhjB/hdqFAA/VygGAA/i7folB/TM
---------------------------------------------------------------------~->

Forget the BDE - Use TinyDB for Delphi!
http://www.delphicollection.com/public/TinyDB.htm
---------------------------------------------------------------
Unsubscribe:delphi-programming-***@yahoogroups.com
List owner:delphi-programming-***@yahoogroups.com
---------------------------------------------------------------

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Post by Markus Ostenried
Hi all,
type
TTMD_Type = (
tmdCliMemo,
tmdRezMemo,
tmdTermMemo
);
TTifRelDef = record
RelationType: String;
TableName: String;
KeyField: String;
end;
const
TifRelDefs: Array[TTMD_Type] of Array of TTifRelDef = (
???
);
With each value of TTMD_Type I want to access another array containing the
records.
( // Array for tmdCliMemo
'ID_CLIENT'),
'ID_MITARBEITER')
),
( // Array for tmdRezMemo
(RelationType: 'SUBJECT', TableName: 'CLIENTEN', KeyField: 'ID_CLIENT'),
(RelationType: 'SUBJECT', TableName: 'REZEPTE', KeyField: 'ID_REZEPT')
),
( // Array for tmdTermMemo
(RelationType: 'SUBJECT', TableName: 'TERMINE', KeyField: 'ID_TERMIN')
)
but it didn't work (undeclared identifier: 'RelationType'). Can anybody
help me, please ?
Thanks,
Markuss,

2 porblems as I see it.
First - you have an excess of brackets
Second - you have an Array [Boolean] of TTifRelDef where you want a TTifRelDef
in 2 places (tmdCliMemo & tmdRezMemo). What you should have is more like :-

TifRelDefs: Array[TTMD_Type] of Array of TTifRelDef =
(( // Array for tmdCliMemo
RelationType: 'RECIPIENT', TableName: 'CLIENTEN', KeyField: 'ID_CLIENT'),
( // Array for tmdRezMemo
RelationType: 'SUBJECT', TableName: 'CLIENTEN', KeyField: ID_CLIENT'),
( // Array for tmdTermMemo
RelationType: 'SUBJECT', TableName: 'TERMINE', KeyField: 'ID_TERMIN'));


Regards,
Allan Smith (Northwood, Middlesex, England)

------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get 128 Bit SSL Encryption!
http://us.click.yahoo.com/xaxhjB/hdqFAA/VygGAA/i7folB/TM
---------------------------------------------------------------------~->

Forget the BDE - Use TinyDB for Delphi!
http://www.delphicollection.com/public/TinyDB.htm
---------------------------------------------------------------
Unsubscribe:delphi-programming-***@yahoogroups.com
List owner:delphi-programming-***@yahoogroups.com
---------------------------------------------------------------

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
thanks Alan,
but this gives me the same error when I save the code at the end of this
message to project1.dpr and compile.

I know that I can define a constant array of string like this:
type
MyType = (a, b ,c);
const
MyConst: Array[MyType] of String = ('a', 'b', 'c');

and the example in Delphi help about constant array of records looks like this:
type
TPoint = record
X, Y: Single;
end;
TVector = array[0..1] of TPoint;
const
Line: TVector = ((X: -3.1; Y: 1.5), (X: 5.8; Y: 3.0));

but how do you declare an Array[MyType] that contains dynamic TVector arrays ?
I just discovered that if below I replace "Array of TTifRelDef" with
"Array[0..1] of TTifRelDef" and add a second record for "tmdTermMemo" it
works perfectly. Could it be that you cannot declare dynamic arrays as
constants ? But then I wonder why the compiler says "Undeclared Identifier:
'RelationType'"...
Thanks,
Markus

<code>
program Project1;

type
TTMD_Type = (
tmtCliMemo,
tmtRezMemo,
tmtTermMemo
);

TTifRelDef = record
RelationType: String;
TableName: String;
KeyField: String;
end;

const
TifRelDefs: Array[TTMD_Type] of Array of TTifRelDef = (
// Array for tmdCliMemo: 2 records
( (RelationType: 'REC'; TableName: 'CLI'; KeyField: 'ID_CLI'),
(RelationType: 'SEND'; TableName: 'MIT', KeyField: 'ID_MIT')
),
// Array for tmdRezMemo: 2 records
( (RelationType: 'SUB', TableName: 'CLIN', KeyField: 'ID_CLI'),
(RelationType: 'SUB', TableName: 'REZ', KeyField: 'ID_REZ')
),
// Array for tmdTermMemo: 1 record
( (RelationType: 'SUB', TableName: 'TERM', KeyField: 'ID_TERM')
)
);

begin
end.
</code>


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get 128 Bit SSL Encryption!
http://us.click.yahoo.com/xaxhjB/hdqFAA/VygGAA/i7folB/TM
---------------------------------------------------------------------~->

Forget the BDE - Use TinyDB for Delphi!
http://www.delphicollection.com/public/TinyDB.htm
---------------------------------------------------------------
Unsubscribe:delphi-programming-***@yahoogroups.com
List owner:delphi-programming-***@yahoogroups.com
---------------------------------------------------------------

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/