Skip to Content

stringToFloat for calculate then back to string

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);

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Feb 17, 2014 at 05:55 PM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

    • 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

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.