cancel
Showing results for 
Search instead for 
Did you mean: 

stringToFloat for calculate then back to string

hs1
Participant
0 Kudos

Hi @ All, i get three Value per getDataAsStringExt. The Value's (Stringvalue) are correct. I printed out.


In the End i will calculate three Floats with + plus for Total, but the Total (P_Summe_A) is every time 0.


I hope anyone can help. I don'tknow what is wrong. It is so simple. thx  BR Harry

var Hierarchie = "Z102";

// Gesamtsummen Aktiva und Passiva

// Passivgesamtsummen

var PSA = CO_PASSIVA_KOMPLETT.getDataAsStringExt("00O2TL0YRWXBRYAQ2SLGYV4J9", {"A00000287":Hierarchie +"2000000","0FISCYEAR":Ge_Jahr});

var PSV = CO_PASSIVA_KOMPLETT.getDataAsStringExt("00O2TL0YRWXBRYAQ2SLGYV4J9", {"A00000287":Hierarchie +"2000000","0FISCYEAR":Convert.subString(Ge_Vorjahr,0,4)});

// Anhangssummen

var PAA = ANHANG.getDataAsStringExt("00O2TL0YRWXBRYAQ2SLGYV4J9", {"A00000287":Hierarchie +"8000000","0FISCYEAR":Ge_Jahr});

var PAV = ANHANG.getDataAsStringExt("00O2TL0YRWXBRYAQ2SLGYV4J9", {"A00000287":Hierarchie +"8000000","0FISCYEAR":Convert.subString(Ge_Vorjahr,0,4)});

// G + V Summen

var PGA = G_V.getDataAsStringExt("00O2TL0YRWXBRYAQ2SLGYV4J9", {"A00000287":Hierarchie +"3000000","0FISCYEAR":Ge_Jahr});

var PGV = G_V.getDataAsStringExt("00O2TL0YRWXBRYAQ2SLGYV4J9", {"A00000287":Hierarchie +"3000000","0FISCYEAR":Convert.subString(Ge_Vorjahr,0,4)});

var P_Summe_A =Convert.floatToString(Convert.stringToFloat(PSA)+Convert.stringToFloat(PAA)+Convert.stringToFloat(PGA));

var P_Summe_V =Convert.floatToString(Convert.stringToFloat(PSV)+Convert.stringToFloat(PAV)+Convert.stringToFloat(PGV));

S_AJ_P.setText(P_Summe_A );

S_VJ_P.setText(P_Summe_V);

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Have you tried putting the Convert.stringToFloat function calls on separate lines and then adding a break point so you can see the results of each call? You need to identify where the zeros are coming from and it will be much easier using the JavaScript debugger than it is printing out values.

hs1
Participant
0 Kudos

Hi Robin,

thanks for posting.

I found one of the problem.

the var PAA (String) = "-397"

The Designstudio Variable Float = Fl1 = Convert.stringToFloat(PAA)

then

var P_Sum = Convert.FloatToString(Fl1)  =  WRONG -397.0   DOT are Thousand

but PAA are only -397 not Thousend.

It is craze

Robin you can make this simple sample

var XY1 = "-397";

var XY2 = Convert.stringToFloat(XY1);

var P_Summe_A = Convert.floatToString(XY2);


the result "-397.0"


I Think loatToStringUsingLocale is the right way becouse Dot is in German ,


//  Yes that is the right answer //

br Harry

Answers (0)