Autor Beitrag
Jagg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 635



BeitragVerfasst: Mi 03.11.04 23:54 
Hallo Leute !

Könnt ihr mir sagen was daran falsch ist ?

ausblenden Delphi-Quelltext
1:
Result:=Findfield('F'+fil).AsInteger*1.16;					

...hierbei sagt er mir die meldung:
Zitat:
Inkompatible Typen..Integer und Extended...


wobei Result einen Integerwert zurückliefert. ich weiss nicht wie ich das anders schreiben soll. könnt ihr mir helfen?

Jagg

Moderiert von user profile iconTino: Quote-Tags hinzugefügt.
Moderiert von user profile iconTino: Topic aus Sonstiges verschoben am Mo 08.11.2004 um 13:05
bms
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 735

Win XP
Delphi 3, Delphi 6 PE, Delphi 2005 PE
BeitragVerfasst: Do 04.11.04 00:19 
ausblenden Delphi-Quelltext
1:
Result:=Findfield('F'+fil).AsInteger*1.16;					


Manchmal sieht man vol lauter Bäume den Wald nicht mehr.

AsInteger*1.16

Das ist Interger mal Extended. Ergebnis ist Extended. Result erwartet aber Interger.

Möglichkeit TRUNC()

_________________
VORSICHT: Ich behersche seit heute die Fünf-Finger-Handflächen-Herz-Explodier-Schlag-Kampf-Technik >:(
herzi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 168

WINXP pro, SUSE Linux 9.0
D7 Pers.
BeitragVerfasst: Do 04.11.04 09:26 
gehts nicht auch so..... ?

ausblenden Quelltext
1:
Result:=Findfield('F'+fil).AsFloat*1.16;					
st-matze
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 138

Win 3.11, Win 95, Win 98, Win XP
D7 Ent, D6 Pers, (D5 Pers)
BeitragVerfasst: Do 04.11.04 09:41 
Nö. geht nicht.
entweder machst du aus dem Result einen gleitkommatypen (float, double) oder du änderst die rechte seite zu einem integer. anders gehts nicht

mit
ausblenden Delphi-Quelltext
1:
Result:=Findfield('F'+fil).AsFloat*1.16;					

steht da ja immer noch

[integer]:=[float]*[float]

mach das doch wie schon gesagt mit trunc oder round

ausblenden Delphi-Quelltext
1:
Result:=System.Round(Findfield('F'+fil).AsFloat*1.16);					
Default112
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 76

Win XP
D6 Prof
BeitragVerfasst: Do 04.11.04 16:23 
Ich hatte ein das selbe Problem und hab da was gebaschtelt, zwar nicht schön, aber es funzt :D

ausblenden Delphi-Quelltext
1:
Variable2 := strtoint(FloattoStrF(Variable,ffFixed,15,0));					


Hab also einen Extended (Variable) und möchte den in ein Integer packen (Variable2) Damit gehts super :D Gefällt mir zwar nich, alles erst in einen String zu konvertieren, aber es erfüllt seinen Zweck.
Default112
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 76

Win XP
D6 Prof
BeitragVerfasst: Do 04.11.04 16:24 
Oh, hmm... ein Post höher ists schon gelöst, aber sagt mal, wo ist "edit" hin??
st-matze
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 138

Win 3.11, Win 95, Win 98, Win XP
D7 Ent, D6 Pers, (D5 Pers)
BeitragVerfasst: Do 04.11.04 16:28 
@default122


kuckst du
ausblenden Delphi-Quelltext
1:
2:
3:
//Definition von Trunc
function Trunc(X: Extended): Int64;
//         Extended^^     zu  ^^Integer


is viel einfacher als das stringkonvertiere
Default112
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 76

Win XP
D6 Prof
BeitragVerfasst: Do 04.11.04 16:33 
*sofortinmeinprojekteinfügentut* Naja jetz weiss ichs ja ^^ War eher aus einer Not geboren. 10 Min. kein Internet, zu dumm für die Hilfe... da musste halt was her ;)