Autor Beitrag
Nomis
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 72



BeitragVerfasst: Sa 01.01.05 15:35 
Hallo zusammen :

Ich habe zwei kleine Fragen.

Ich habe eine Paradox7 tabele mit dem Feld Verkauf das ich als Währung deklariert habe.

1. jetzt habe ich das Problem, das ich die aus der Tabelle Auslesen möchte und in eine Variable schreiben möchte wie muss ich die variable verkauf deklarieren damit

verkauf := table1.FieldValues['Verkauf']

funktioniert.

2 dann möchte ich den € Preis in einem Label anzeigen lassen muss in also in einen String umwandeln da hab ich keine vorstellung wie ich das machhe

Danke schon mal für euer Hilfe

Gruß Simon
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: Sa 01.01.05 15:42 
wie wäre es wenn du ein Feld hast : Betrag (gleitkomma), Währung (String[5]) dann kannste das easy handeln
Nomis Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 72



BeitragVerfasst: Sa 01.01.05 15:48 
sorry bin noch nicht so fit fit in dem bereich

könntest du das nochmal für anfänger erklähren
???
:-)
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: Sa 01.01.05 15:51 
anstatt einem feld das irgendeinen proprietären typ hat kannste auch 2 felder machen: ein standard-zahlen feld (mit kommawerten)m beinhaltet den betrag (zb 3,50), und ein feld des typs string, welches die Währung beinhaltet also z.b. 'Euro'
Nomis Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 72



BeitragVerfasst: Sa 01.01.05 16:00 
So hört sch das logisch an

Ich deklariere also

Verkauf : float; (kennt er schon mal nicht)

verkauf := table1.fieldvalues['Verkauf]

lablel3.caption := ???? verkauf ????

wie mache ih also aus dem float ein string ?
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: Sa 01.01.05 16:04 
unter delphi heissen die datentypen so:
Zitat:

Typ Bereich Signifikante Stellen Größe in Byte
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


nimm single oder double

edit:



Nomis hat folgendes geschrieben:

lablel3.caption := ???? verkauf ????
wie mache ih also aus dem float ein string ?

lablel3.caption := FloatToStr(verkauf)


Zuletzt bearbeitet von retnyg am Sa 01.01.05 16:08, insgesamt 1-mal bearbeitet
Nomis Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 72



BeitragVerfasst: Sa 01.01.05 16:07 
Okay soweit klar jetzt hoffe ich das ich dich das letze mal nerve und zwar wie ich aus einem single einen String mache
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: Sa 01.01.05 16:09 
siehe edit oben :P
Nomis Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 72



BeitragVerfasst: Sa 01.01.05 17:40 
Du meinst das mit dem Währung (string[5]) verstehe das nicht ganz wie müsste ich das denn genau anwenden ?

Label1.caption := ?

Gruß Simon
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: Sa 01.01.05 18:12 
string[5] bedeutet nur dass es sich um einen string mit der länge von 5 zeichen handelt. das sollte eigentlich für alle gängigen Währungskürzel ausreichen.

einen string kannst du direkt übergeben, da label.caption auch vom typ string ist
Nomis Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 72



BeitragVerfasst: Sa 01.01.05 18:25 
Mein Problem liegt ja wo ganz anders ich habe die variable "verkauf" vom typ singel

und möchte
label1.caption := verkauf ;

was natürlich nicht geht da man ein single nicht ohne es umzuformen als string ausgeben kann. Könntest du mir diese zeile mal kurz so schreiben das es funktioniert ? Wäre echt nett

Danke

Gruß Simon
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: Sa 01.01.05 18:27 
retnyg hat folgendes geschrieben:

Nomis hat folgendes geschrieben:

lablel3.caption := ???? verkauf ????
wie mache ih also aus dem float ein string ?

lablel3.caption := FloatToStr(verkauf)
Nomis Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 72



BeitragVerfasst: Sa 01.01.05 18:34 
Danke genau das brauchte ich :lol:
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: Sa 01.01.05 18:36 
bitteschön :mrgreen:
CenBells
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1547

Win 7
Delphi XE5 Pro
BeitragVerfasst: Sa 01.01.05 18:44 
hi,

um auch meinen senf dazuzugeben. Es gibt auch die Funktion CurrToStr, die dazu da ist, währungswerte in einen string umzuwandeln...

Gruß
Ken

_________________
Eine Klasse beschreibt die Struktur und das Verhalten einer Menge gleichartiger Objekte.
Nomis Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 72



BeitragVerfasst: So 02.01.05 14:50 
noch besser :-) brauch ich den ganzen krempel mit String[5] nicht allerdings habe ich hier genau das selbe problem :
in der Tabelle steht 1,00 es wird aber nur 1 angezeigt genauso stat 0,80 wird nur 0,8 angezeigt lässt sich irgendwie immer 2 ziffern hinter dem Komma anzeigen ?


Gruß Simon
grayfox
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 800

win98, winXP
D4 Standard; D6 Personal
BeitragVerfasst: So 02.01.05 15:16 
hallo simon!

sieh dir in der online-hilfe zu delphi 'formatstrings' an. damit solltest du dein problem ein für allemal erschlagen können

mfg, stefan