Hello,

I have two calculations that I want to combine and I am having trouble doing so. Both work individually. When I try to combine them, FMP throws and error:

and then highlights this:

**The first: (removes leading zeros from field-- I took this off the forum, so please don't think I know what I am doing! )**

**https://community.filemaker.com/thread/120925?q=removing%20leading%20zeros curtesy of LaRetta_1**

Let ( [

t = LeftWords ( Location Calculation ; 1 ) ;

x = Filter ( LeftWords ( t ; 1 ) ; "0123456789" ) = LeftWords ( t ; 1 ) ;

l = Length ( LeftWords ( t ; 1 ) ) ;

n = GetAsNumber ( LeftWords ( t ; 1 ) )

] ;

Case (

x ; n & Right ( t ; Length ( t ) - l ) ; t

) // end case

) // end let

**And the second: (****substitutes)**

Substitute (

${Copy)} ;

["XLEVEL#" ; "*" & Level from Space] ;

["LEVEL#" ; Level from Space] ;

["STAIR#" ; Stair from Space] ;

["BLDG#" ; Building from Space] ;

["LOC#" ; LeftWords ( Location Calculation ; 1 )] ; **This is the substitution that would need the leading zeros removed **

["TBD" ; TextStyleAdd ( "TBD" ; HighlightYellow )]

)

Any guidance is appreciated!

Happy New Year!

-L

Convert the final result calculation of the Let( ) into another variable declaration, and make the second calc the end result:

Let ( [

t = LeftWords ( Location Calculation ; 1 ) ;

x = Filter ( LeftWords ( t ; 1 ) ; "0123456789" ) = LeftWords ( t ; 1 ) ;

l = Length ( LeftWords ( t ; 1 ) ) ;

n = GetAsNumber ( LeftWords ( t ; 1 ) ) ;

locationCalculationWithoutLeadingZeroes=Case (

x ;

n & Right ( t ; Length ( t ) - l ) ;

t

)

] ;

// And the second: (substitutes)Substitute (

${Copy)} ;

[ "XLEVEL#" ; "*" & Level from Space ] ;

[ "LEVEL#" ; Level from Space ] ;

[ "STAIR#" ; Stair from Space ] ;

[ "BLDG#" ; Building from Space ] ;

[ "LOC#" ;

locationCalculationWithoutLeadingZeroes] ;//

This is the substitution that would need the leading zeros removed[ "TBD" ; TextStyleAdd ( "TBD" ; HighlightYellow ) ]

)

)