String token replacement question

Hi all,

Hope i can get some guidance on this - feels like there should be a simple solution.

My goal is to have a string token evaluated as such when it's origin is from another property.

Example:

@MyGlobal := 'TestValue';

GlobalReference := '\$'.'(MyGlobal)';

GlobalValue := GlobalReference;

This returns a record with two properties, GlobalReference and GlobalValue, each with the value: \$(MyGlobal).

How can I get the GlobalValue property to display the value of @MyGlobal when using the value of GlobalReference as its pointer?

I've tried using regexp to replace hte \$() charachters but that's not working (see below - the final rsubst() funxction won't work as intended) and in any case it seems a convulted way to go about this problem

@MyServer := 'MyServer';

FileLocation := '\$'.'(MyServer)\MyFile';

GlobalProp := rmatch(FileLocation,'\\$\(.+\)','ig');

GlobalPropMod := rsubst(GlobalProp,'\\$\(','');

GlobalPropMod := rsubst(GlobalPropMod,'\)','');

ExplicitFL := rsubst(FileLocation,GlobalProp,globalproperty(GlobalPropMod));

Anyone able ot solve this for me?

Many thanks,

Tristan