BaBernd
13th July 2015, 18:44
Hello to All,

I'd like to convert the Price of tdpur401.pric into a string. Or instead of the Price from tdipu001.prip to a string value.
I've tested with str$(tdpur401.pric). But I've read that is only for Long values.
For double values I should use sprintf$()-function. But sprintf$ will only transform strings and not double as I've read in the description. So what can I do now?

The formatting example are always poor cause there is no where written how to include a table field like "tdpur401.pric" or a variable which is declared as double value.

Best Regards
Bernd

manish_patel
13th July 2015, 20:14
I've tested with str$(tdpur401.pric). But I've read that is only for Long values.
For double values I should use sprintf$()-function. But sprintf$ will only transform strings and not double as I've read in the description.

This is not true. You can use edit$(), sprintf$() or str$() function for the same.



The formatting example are always poor cause there is no where written how to include a table field like "tdpur401.pric" or a variable which is declared as double value.

In expression argument of edit$() and sprintf$() function you can put table field or variable.

BaBernd
14th July 2015, 17:11
Hello Manish,

thanks for your advice but I Need a Little more help:

I use the function sprintf$("%10.g", tdpur401.pric) and it Returns a value "10.5" from the database.
But when I assign it to a string variable I've declared in advance like
declaration:
string rep.price
assignment:
rep.price = sprintf$("%10.g", tdpur401.pric)

then the variable rep.price Returns the value "1".
So my question is: what mistake I've made within the declaration or the assignment?.

Regards
Bernd

manish_patel
14th July 2015, 20:32
Increase string length of your variable


declaration:
string rep.price(10) | strings of length 10

BaBernd
17th July 2015, 12:37
Hello Manish,

thanks for help. I declared it as extern Domain.

Best Regards
Bernd