We help IT Professionals succeed at work.
Get Started

How to declare a Constant array of array of Record in Delphi

fischermx
fischermx asked
on
7,522 Views
Last Modified: 2012-05-11
Hi,

Let's suppose the following code, which is used as sample, that is to declare a Constant array of record:

type
    TShopItem = record
      Name : string;
      Price : currency;
    end;

const
    Items : array[1..3] of TShopItem =
    (
      (Name : 'Clock'; Price : 20.99),
      (Name : 'Pencil'; Price : 15.75),
      (Name : 'Board'; Price : 42.96)
    ) ;


What if I want to declare a to declare a Constant array of array of record (array of array).
How do I declare that?

Taking the previous classes, now suppose that I have "groups" of TShopItem's, like :

Group 1
      (Name : 'Clock'; Price : 20.99)
      (Name : 'Pencil'; Price : 15.75)

Group 2
      (Name : 'Board'; Price : 42.96)
      (Name : 'Eraser'; Price : 2.96)

Group 3 (note different length)
      (Name : 'Paper'; Price : 5.96)
      (Name : 'Pen'; Price : 2.96)
      (Name : 'Postits'; Price : 2.96)

How do I put all that in a single constant array of array declaration?
Comment
Watch Question
Freelance Project Manager
CERTIFIED EXPERT
Top Expert 2010
Commented:
This problem has been solved!
Unlock 3 Answers and 13 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE