Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "Базы";
Текущий архив: 2004.11.21;
Скачать: [xml.tar.bz2];

Вниз

CleintDataSet   Найти похожие ветки 

 
OlegL   (2004-10-26 13:40) [0]

Скажите пожайлуста как мне добратся до своиства Currency у полей ClientDataSet если они (поля) создаются в run-time.
Я пробовал
(DataModule2.ClientDataSet1.Fields.FieldByName(имя поля) as TFloatField).currency := false;

(Я знаю как поле будет называтся.)
Говорит "Invalid class typecast". В принципе я понемаю что TField это не TFloatField но они же родственники. :-))
Как мне сделать?


 
Johnmen ©   (2004-10-26 13:45) [1]

TCurrencyField(DataModule2.ClientDataSet1.Fields.FieldByName(имя поля))

>...).currency := false;

А может ты что-то путаешь ? :)


 
Ega23 ©   (2004-10-26 13:47) [2]


ds:TDataSet

if ds.FieldByName("AAA").AsCurrency


 
OlegL   (2004-10-26 13:52) [3]


> Johnmen ©

Так вот и скажи мне что я путаю.

> Ega23 ©

Я хочу свойство Currency поменять в false.


 
Ega23 ©   (2004-10-26 13:54) [4]

Я хочу свойство Currency поменять в false.

Набери в хелпе слово Currency, а также False, и ты поймёшь, что Johnmen © в [1] был прав.


 
OlegL   (2004-10-26 14:01) [5]

Я так и не понял в чём
> Johnmen ©
был прав


 
Johnmen ©   (2004-10-26 14:05) [6]

>OlegL   (26.10.04 14:01) [5]

Прав в том, что указал на некоторую странность в коде...
А ты не понял потому, что не следуешь рекомендации почитать хелп на currency и false :)


 
OlegL   (2004-10-26 14:08) [7]

Если бы я понял из хелпа я бы не писал в форуме.


 
Johnmen ©   (2004-10-26 14:12) [8]

Тогда ещё раз конкретный вопрос.
А на тот, который в теме - уже ответили [1], [2].


 
Ega23 ©   (2004-10-26 14:13) [9]

Читаем:
Currency + F1:
A real type defines a set of numbers that can be represented with floating-point notation. The table below gives the ranges and storage formats for the fundamental real types.

Type Range Significant digits Size in bytes
Real48 2.9 x 10^–39 .. 1.7 x 10^38 11–12 6
Single 1.5 x 10^–45 .. 3.4 x 10^38 7–8 4
Double 5.0 x 10^–324 .. 1.7 x 10^308 15–16 8
Extended 3.6 x 10^–4951 .. 1.1 x 10^4932 19–20 10
Comp –2^63+1 .. 2^63 –1 19–20 8
Currency –922337203685477.5808.. 922337203685477.5807 19–20 8
The generic type Real, in its current implementation, is equivalent to Double.

Type Range Significant digits Size in bytes
Real 5.0 x 10^–324 .. 1.7 x 10^308 15–16 8
Note: The six-byte Real48 type was called Real in earlier versions of Object Pascal. If you are recompiling code that uses the older, six-byte Real type, you may want to change it to Real48. You can also use the {$REALCOMPATIBILITY ON} compiler directive to turn Real back into the six-byte type.

The following remarks apply to fundamental real types.

Real48 is maintained for backward compatibility. Since its storage format is not native to the Intel CPU family, it results in slower performance than other floating-point types.
Extended offers greater precision than other real types but is less portable. Be careful using Extended if you are creating data files to share across platforms.
The Comp (computational) type is native to the Intel CPU and represents a 64-bit integer. It is classified as a real, however, because it does not behave like an ordinal type. (For example, you cannot increment or decrement a Comp value.) Comp is maintained for backward compatibility only. Use the Int64 type for better performance.

Currency is a fixed-point data type that minimizes rounding errors in monetary calculations. It is stored as a scaled 64-bit integer with the four least-significant digits implicitly representing decimal places. When mixed with other real types in assignments and expressions, Currency values are automatically divided or multiplied by 10000.


False + F1 :

The four predefined Boolean types are Boolean, ByteBool, WordBool, and LongBool. Boolean is the preferred type. The others exist to provide compatibility with different languages and the Windows environment.
A Boolean variable occupies one byte of memory, a ByteBool variable also occupies one byte, a WordBool variable occupies two bytes (one word), and a LongBool variable occupies four bytes (two words).

Boolean values are denoted by the predefined constants True and False. The following relationships hold.

Boolean ByteBool, WordBool, LongBool
False < True False <> True
Ord(False) = 0 Ord(False) = 0
Ord(True) = 1 Ord(True) <> 0
Succ(False) = True Succ(False) = True
Pred(True) = False Pred(False) = True
A value of type ByteBool, LongBool, or WordBool is considered True when its ordinality is nonzero. If such a value appears in a context where a Boolean is expected, the compiler automatically converts any value of nonzero ordinality to True.
The remarks above refer to the ordinality of Boolean values—not to the values themselves. In Object Pascal, Boolean expressions cannot be equated with integers or reals. Hence, if X is an integer variable, the statement

if X then ...;

generates a compilation error. Casting the variable to a Boolean type is unreliable, but each of the following alternatives will work.

if X <> 0 then ...;        { use longer expression that returns Boolean value }
var OK: Boolean            { use Boolean variable }

...
if X <> 0 then OK := True;
if OK then ...;


 
Johnmen ©   (2004-10-26 14:15) [10]

>Ega23 ©   (26.10.04 14:13) [9]

Судя по OlegL   (26.10.04 14:08) [7] требуется перевод на русский !
:)


 
Плохиш ©   (2004-10-26 14:20) [11]


> Johnmen ©   (26.10.04 14:12) [8]
> Ega23 ©   (26.10.04 14:13) [9]

Он вообще-то про свойство currence у TFloadField спрашивает.

> OlegL   (26.10.04 13:40)

> Говорит "Invalid class typecast".

Значит создал поле не типа float.


 
Плохиш ©   (2004-10-26 14:23) [12]

2OlegL

Посмотри ClassName у своего поля.


 
Ega23 ©   (2004-10-26 14:24) [13]

Ну тогда
TFloatField(ds.FieldByName("AAA")).Currency:=False;


 
Johnmen ©   (2004-10-26 14:28) [14]

>Плохиш ©

Вот оно что ! А я не догнал !

>OlegL  

Тогда см.
DataModule2.ClientDataSet1.Fields.FieldByName(имя поля).FieldType



Страницы: 1 вся ветка

Форум: "Базы";
Текущий архив: 2004.11.21;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.49 MB
Время: 0.043 c
14-1099428143
TDK
2004-11-02 23:42
2004.11.21
Загрузка и синий экран "смерти"


1-1099571574
тт
2004-11-04 15:32
2004.11.21
Можно-ли dll интегрировать в exe?


1-1099457813
leonidus
2004-11-03 07:56
2004.11.21
Создание своей панели в IE


14-1099758067
Александр1
2004-11-06 19:21
2004.11.21
windows 2003


6-1095161126
bsa
2004-09-14 15:25
2004.11.21
как извлечь текст (убрать тэги) из html





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский