# Combining or nest calculations

Question asked by lindseym on Dec 30, 2016
Latest reply on Dec 30, 2016 by erolst

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

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