Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Type question for DBPro

Author
Message
Philip
21
Years of Service
User Offline
Joined: 15th Jun 2003
Location: United Kingdom
Posted: 5th Jul 2003 18:21
Yep, me again I'm afraid. (The audience groans). I'm stuck again. (The audience groans). This time I'm trying to work out whether you can put one TYPE into another TYPE in DBPro. For example, can I put this TYPE



Into this TYPE



All thoughts gratefully received.

By the way, the names and variables in the TYPEs have been changed to protect the innocent.

Cheers

Phil
Coming up... a hell of a 3D Space Trading Game!
haggisman
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 5th Jul 2003 18:43
This is taken from the DBpro help system:-

Quote: "As you will eventually discover you can have types within types for more complex data structures so we
can imagine one of the fields contains more than one value. We would define two user defined types, and
then use one of them in the declaration of one of the fields of the section user defined type, as follows:

TYPE AmountsType
CurrentBalance AS FLOAT
SavingsBalance AS FLOAT
CreditCardBalance AS FLOAT
ENDTYPE
TYPE AccountEntryType
Number AS INTEGER
Name AS STRING
Amount AS AmountsType
ENDTYPE
DIM Accounts(100) AS AccountEntryType
Accounts(1).Number=12345
Accounts(1).Name="Lee"
Accounts(1).Amount.CurrentBalance=0.42
Accounts(1).Amount.SavingsBalance=100.0
Accounts(1).Amount.CreditCardBalance=-5000.0

As you can see, user defined types are not only powerful, they make the readability of your programs far
easier. Using named fields instead of a subscript value within an array, you can save yourself many hours
all for the sake of an incorrect subscript value throwing out your program results.
"


project: light/obscurance mapper (85% done)
Philip
21
Years of Service
User Offline
Joined: 15th Jun 2003
Location: United Kingdom
Posted: 5th Jul 2003 19:10
Yep, I'm aware of that but it didn't help me much because its basically information in an array passed into a TYPE. I'm wondering whether I put one TYPE into another.

Maybe I'm just having a dense moment.

Phil

Coming up... a hell of a 3D Space Trading Game!
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 5th Jul 2003 19:15
You are allowed to put a type inside of another.

Login to post a reply

Server time is: 2024-09-20 13:27:47
Your offset time is: 2024-09-20 13:27:47