1) create a property that will contain the desired path.
2) create a property based folder.
1) Go to the "Search" page -> "New Search" button to create a property (named let's say MYPATH) that will contain the result of a search. Now select this property, use "Add location">"Registry" and select the key that you want.
When the installation will begin MYPATH will contain that registry value that may be your desired path.
2)From the "Files and Folders" page use "New Folder">"Property Based" and select MYPATH. Place your files in that property based folder. These files will be installed in the folder that has the path which is contained in the MYPATH property.
You can include properties to define what value from registry you want to get but these properties must be already defined at the beginning of the installation, you can't use properties that are defined during the installation.
So you must create your own custom action in which you will read the registry and get the path and then you can redirect your TARGETDIR.