troubleshooting Question

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

Avatar of fischermx
fischermxFlag for Mexico asked on
13 Comments3 Solutions7555 ViewsLast Modified:

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

    TShopItem = record
      Name : string;
      Price : currency;

    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?
Freelance Project Manager

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Top Expert 2010

The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.

Join our community to see this answer!
Unlock 3 Answers and 13 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 13 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros