# Nested IF / Let Function - adding one more step

Discussion created by lindseym on Jun 13, 2017
Latest reply on Jun 14, 2017 by lindseym

Hello,

I while ago erolst helped me with this solution from this thread:Combining or nest calculations  and it's worked beautifully and evolved since then.

What I want it to calculate is:

When PROJECT::BB RAW = "RAW" instead of getting the left words of the "Location Calculation" it needs to just get the contents from "Location" and still remove the leading zeros.

Additionally, I would still like the substitutions after the let function work regardless of what PROJECT::BB RAW equals.

Things have come a longgggg way for me - but I'm caught up on adding that condition to this calculation:

------------------------------------------------------

If ( PROJECT::BB RAW = "RAW"; Copy Side A ;

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

)

] ;

// And the second: (substitutes)

Substitute (

\${Copy Side A} ;

[ "XLEVEL#" ; "★" & Level Trimmed] ;

[ "(*)" ; "★"] ;

[ "(STAR)" ; "★"] ;

[ "^" ; "↑"] ;

[ "<" ; "←"] ;

[ ">" ; "→"] ;

[ "*v" ; "↓"] ;

[ "(ua)" ; "↑"] ;

[ "(la)" ; "←"] ;

[ "(ra)" ; "→"] ;

[ "(da)" ; "↓"] ;

[ "XL#" ; Exiting Level ] ;

[ "UPX/DNX" ; Exit What Level ] ;

[ "LEVELRANGE" ; Level Range ] ;

[ "LEVEL#" ; Level Trimmed] ;

[ "STAIR#" ; Stair# ] ;

[ "BLDG#" ; Building C ] ;

[ "TBD/ROOF/ACCESS" ; Roof Access ] ;

[ "LOC#" ; locationCalculationWithoutLeadingZeroes ] ;

// This is the substitution that would need the leading zeros removed

[ ";" ; "¶" ] ;

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

) )

-------------------------------------------------------------------

Thank you