etsmarines Posted June 18, 2014 Posted June 18, 2014 I have a field called version. Some of the values contain multiple decimals for example 10.12.73.10 I want to trim them down to only contain 1 decimal so in other words 10.12.73.10 would become 10.12 another example would be 7456.342.4728.123 would become 7456.342 how do i do that? Thanks again! -Erik
comment Posted June 18, 2014 Posted June 18, 2014 (edited) Try: Let ( dot2 = Position ( Version ; "." ; 1 ; 2 ) ; Case ( dot2 ; Left ( Version ; dot2 - 1 ) ; Version ) ) -- What the heck, let's have another: Substitute ( LeftWords ( Substitute ( Version ; "." ; ¶ ) ; 2 ) ; ¶ ; "." ) Edited June 18, 2014 by comment 2
Raybaudi Posted June 19, 2014 Posted June 19, 2014 (edited) This, not simpler, is another one: Left ( version ; Max ( Position ( version & "." ; "." ; 1 ; 1 ) - 1 ; Position ( version & "." ; "." ; 1 ; 2 ) - 1 ) ) Edited June 19, 2014 by Raybaudi
comment Posted June 19, 2014 Posted June 19, 2014 This, not simpler, is another one: Left ( version ; Max ( Position ( version & "." ; "." ; 1 ; 1 ) - 1 ; Position ( version ; "." ; 1 ; 2 ) - 1 ) ) You didn't test this with "123.45".
Raybaudi Posted June 19, 2014 Posted June 19, 2014 I did, but I'm missing something. Calculation edited.
etsmarines Posted June 19, 2014 Author Posted June 19, 2014 Thanks guys but I'm getting my numbers in a weird format. I didi exactly what you listed above in the first Position formula. It is making the first decimal a comma.
comment Posted June 19, 2014 Posted June 19, 2014 It is making the first decimal a comma. That could happen if (1) the calculation result type is set to Number (it should be Text, of course) and (2) your file is set to use comma as the decimal separator.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now