Skip to main content

Hello,

 

 

In my workspace, I use LenghtCalculator to have the "Distance" from line.

 

I'd like to have three Numbers after .

 

I use Stringformatter on this attribute with Format String .3f but all value not have this setting.

 

 

Someone can help me to fix this?

 

 

I have also tried Attribute Manager with Math Opérator "ROund (Distance, 3). It's the same things.

 

 

Best Regards

 

 

What version of fme are you using? .3f works for me


The AttributeRounder is the easiest way to do this.

Hope this helps.


If I'm looking at the yellow highlight in the screenshot, it seems you want 0.11 formatted as 0.110?

If so, try this in a StringFormatter:

-0.3f

If I'm looking at the yellow highlight in the screenshot, it seems you want 0.11 formatted as 0.110?

If so, try this in a StringFormatter:

-0.3f

Thank you for your answer. I can have number like 1.110 , 2,130 etc..

 

 

Meanwhile I tested but It don't change anything. It's only data calculate with LengthCalculator

0684Q00000ArM4hQAF.png

 

 

 


The AttributeRounder is the easiest way to do this.

Hope this helps.

Hello,

 

 

Thank for your help.

 

 

The AttributeRounder give me the same result. The problem is only with data calculate with Length calculator.

 

 

 


What version of fme are you using? .3f works for me

Hello Thank for your answer.

 

I have try with FME 2020.0 Build 20200 and FME 2020.0.2 Build 20232.

 

If i make like you , it also works for me, but not with my attribute Lg2D (m)

Thank you for your answer. I can have number like 1.110 , 2,130 etc..

 

 

Meanwhile I tested but It don't change anything. It's only data calculate with LengthCalculator

 

 

 

Regardless, if you write "1.110" to Excel, it will still show up in Excel as 1.11, as this is a formatting issue, not a value issue.

Basically you should probably solve this issue in the Excel cell formatting settings.


Regardless, if you write "1.110" to Excel, it will still show up in Excel as 1.11, as this is a formatting issue, not a value issue.

Basically you should probably solve this issue in the Excel cell formatting settings.

Yes I can modify the parameters in Excel and It works but FME must handle it.

 

My purpose it's manage and configure data with FME and not Excel to simplify the work.

 

 

The other value like 335.670 are formatting when we want (Print Screen 1)

 

 

The print screen 2 show the act of formatting in excel and the result (ex 0.970 or 6.980).

 

 

Is it possible, it's a bug in FME?

 

 

Print Screen 1

Print Screen 2

 

 

 

 


You can use the rounder with 3 places and then a StringPadder with desired length as 3, right pad, and 0 as the padding value. That will append a 0. But, the -0.3f should work.


Yes I can modify the parameters in Excel and It works but FME must handle it.

 

My purpose it's manage and configure data with FME and not Excel to simplify the work.

 

 

The other value like 335.670 are formatting when we want (Print Screen 1)

 

 

The print screen 2 show the act of formatting in excel and the result (ex 0.970 or 6.980).

 

 

Is it possible, it's a bug in FME?

 

 

Print Screen 1

Print Screen 2

 

 

 

 

It's difficult to say if it's a bug, because it works for my tiny test case. Are you able to post a minimal workspace here that demonstrates the issue?


You can use the rounder with 3 places and then a StringPadder with desired length as 3, right pad, and 0 as the padding value. That will append a 0. But, the -0.3f should work.

 

Hello,

 

 

Sorry, your solution doesn't work with my Workspace and Data 😞

 

 

 


I'm starting to suspect that FME is trying too hard to be intelligent and preserve the input float datatype, so that when it sees 1.110 cast as a float, it displays as 1.11, because realistically, that's what it is.

Try chaining two StringFormatters together, the first one with format string "s" to force the float to a string-like representation, then the next with "-0.3f" for padding.


I'm starting to suspect that FME is trying too hard to be intelligent and preserve the input float datatype, so that when it sees 1.110 cast as a float, it displays as 1.11, because realistically, that's what it is.

Try chaining two StringFormatters together, the first one with format string "s" to force the float to a string-like representation, then the next with "-0.3f" for padding.

Wonder if it could be related to the attribute type preservation in 2020?

https://knowledge.safe.com/questions/112114/attribute-data-type-preservation-in-fme-2020.html


I'm starting to suspect that FME is trying too hard to be intelligent and preserve the input float datatype, so that when it sees 1.110 cast as a float, it displays as 1.11, because realistically, that's what it is.

Try chaining two StringFormatters together, the first one with format string "s" to force the float to a string-like representation, then the next with "-0.3f" for padding.

Hello.

 

I try your solution, but it doesn't work 😞

 

 


Wonder if it could be related to the attribute type preservation in 2020?

https://knowledge.safe.com/questions/112114/attribute-data-type-preservation-in-fme-2020.html

Perhaps, but i have another attribute that i calculate with Arithmetic Editor and it's works.

 


I covered the answer to this question (I hope) in the question-of-the-week post here:

https://knowledge.safe.com/questions/113630/question-of-the-week-writing-fixed-length-numbers.html

I think the problem is partly each of these:

  • The Table View window is not showing you the correct value. The StringFormatter really does return 0.110 and the Logger transformer proves this.
  • When you write to Excel, the column is a number, and a number column in Excel automatically trims trailing zeros. To fix this you must either:
    • Use a String column type in the FME schema definition
    • Set up an Excel file in which the number is defined as 3 decimal places, and use that as the template in FME. Then a number type shows the correct 3 places.

I hope this is helpful.


I covered the answer to this question (I hope) in the question-of-the-week post here:

https://knowledge.safe.com/questions/113630/question-of-the-week-writing-fixed-length-numbers.html

I think the problem is partly each of these:

  • The Table View window is not showing you the correct value. The StringFormatter really does return 0.110 and the Logger transformer proves this.
  • When you write to Excel, the column is a number, and a number column in Excel automatically trims trailing zeros. To fix this you must either:
    • Use a String column type in the FME schema definition
    • Set up an Excel file in which the number is defined as 3 decimal places, and use that as the template in FME. Then a number type shows the correct 3 places.

I hope this is helpful.

Hello Mark

 

 

Thank for your answer.

The value is Always viewed as 0.11 in FME but I set up a Template Excel File where the number is defined as 3 decimals places and it's good.

 

 

Best Regards

 

 


Reply