# Master Substitution Field?

Question asked by lindseym on Feb 14, 2018
Latest reply on Feb 14, 2018 by lindseym

Hello,

I have at least 4 fields of my project that All use the same substitutions just access a different field. I'm trying to minimize 1. The different places you have to edit the substitutions 2. Clean up the look of calculation.

This is calculation that has been years in the making, with multiple people on this forum helping me.

Let ( [

t = LeftWords ( Location C ; 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} ;      #This is the only part of the calculation that changes#

[ "*LEVEL#" ; "★" & Level Trimmed] ;

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

[ "^" ; "↑"] ;

[ "<" ; "←"] ;

[ ">" ; "→"] ;

[ "*v" ; "↓"] ;

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

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

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

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

[ "LEVEL#" ; Level Trimmed] ;

[ "STAIR#" ; Stair# ] ;

[ "BLDG#" ; Building C ] ;

[ "NO ROOF;(*)" ; "STAIR " & Stair# & ";NO ROOF ACCESS;" & "★" & Level Trimmed] ;

[ "NO ROOF;" ; "STAIR " & Stair# & ";NO ROOF ACCESS;" & Level Trimmed & ";"] ;

[ "YES ROOF;(*)" ; "STAIR " & Stair# & ";ROOF ACCESS;" & "★" & Level Trimmed] ;

[ "YES ROOF;" ; "STAIR " & Stair# & ";ROOF ACCESS;" & Level Trimmed & ";"] ;

[ "TBD ROOF;(*)" ; "STAIR " & Stair# & ";TBD ROOF ACCESS;" & "★" & Level Trimmed] ;

[ "TBD ROOF;" ; "STAIR " & Stair# & ";TBD ROOF ACCESS;" & Level Trimmed & ";" ] ;

[ "#LOC#" ; Location C] ;

[ "LOC#" ; locationCalculationWithoutLeadingZeroes ] ;

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

[ "ECID#" ; Elevator Car C] ;

[ "ELID#" ; Elevator Lobby C] ;

[ "SECT#" ; Section C] ;

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

[ ";" ; "¶" ] ;

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

What I want, if it's possible:

Substitute(

\${Variable Field Name};

*Perform the substitutions based on this master substitutions field*

)

So when I update the master substitutions field all fields that need these substitutions gets updated at once.

I'm thinking sorta like how you make Script A, and then do Perform Script ( A ) in multiple parent scripts. (But I am not asking to make it a script -- unless that's the best practice way to go)

I tried just making a field, and the calculaton to =

[ "*LEVEL#" ; "★" & Level Trimmed] ; .........

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

But it kept telling me I needed a field or constant.

Thanks,

-L