Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 10 Jahren, 2 Monaten
Letzter Beitrag:
vor 10 Jahren, 2 Monaten
Beteiligte Autoren:
Paul, Chris L, P.H.

Text,Numeric,Currency Questions

Startbeitrag von Paul am 12.04.2008 16:15

When creating a file item of type text- if I assign the maximum length to be 5000 characters and the user does not enter anything into it, or enters a lesser amount of characters, how much memory is used to save it? Just what is entered or the memory space for 5000 characters?

Numeric or Currency: To be sure there is no rounding error should I type the File Items as Numeric or Currency? In the Win Express 10 demo, it seemed to say use Currency. However, I remember reading something in the Win 11 documentation that indicated you should use Numeric.

Any answers are greatly appreciated.

Paul Ziegler
Private Advantage Software



Text can actually be stored in three different ways. Character as its name suggests stores just one character and is therefore of rather limited use and could really be left out of the language. String is the most useful and most used type for text; it has a maximum limit of 65 535 characters. The third type Text memo can take a character string up to 4 GB (which should be ample for most purposes!); this is particularly useful for notes because text memos support RTF formatting.

Whether you use strings or text memos, the size is dynamic, ie only the storage space required is used. Add some more text (to either a string or memo) and your file size will increase, and vice versa.

So if you have specified a string with a maximum length of 5000 characters, the user can enter up to 5000 characters (but no more) but if nothing is entered, no space will be used. If you're declaring a variable in your program of string type, then no length is specified (although the 65K limit still applies).

[If you're interfacing your WD with another programming language, then there are some variants of the string type to ensure compatibility with the other language but if it's just a WD application then you only need the standard string or text memo types.]

Numeric vs currency. In the past, I've always stuck with currency for numeric calculations which need to be exact with no rounding off error, typically monetary/financial calculations. My understanding is that WinDev used a form of what used to be called BCD, binary-coded decimal. However, in checking out the Help information in version 11, it seems that the currency type has now been superseded by the numeric type so obviously numeric is also a BCD type. Simply put, it seems that numeric is the same as currency but with a greater number of digits: currency can contain up to 23 significant digits, 17 for the integer part and 6 for the decimal part, while numeric can have up to 38 significant digits, 32 for the integer part and 6 for the decimal part.

The Help file says that the currency type is kept for backward compatibility which suggests that this may be phased out in some future time in favour of the numeric type. However, given PC Soft's past record of keeping backward compatibility for quite a few versions hence, there's no need to drop currency in a hurry unless you need the extra precision. Although the currency type is faster because of the lower precision, my inclination would be to use the numeric type as this looks to be WinDev's future path.

Hope this is of use.

Melbourne, Oz

von Chris L - am 13.04.2008 07:04

Thanks! This was exactly the information that I needed.


von Paul - am 13.04.2008 15:42
A small correction to the sizes of a string variable if I recall correctly...
- As a definition in a datafile (=field) the limit is indeed 65535 except for binary text memo fields)
- As a variable in code the limit is 2GB or 4 GB depending if you're running a 32 or 64 bit operating system. That's why you can treat a binary text memo from a data file in a string variable in code...



von P.H. - am 13.04.2008 22:20
Thanks, Paul, that's something I hadn't realised/known. I use the text memo fields quite a bit for storage of notes of all sorts because of the RTF formatting capability but I must admit that I haven't needed to manipulate these items in code.


von Chris L - am 14.04.2008 03:36
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.