Q:

Is there a variable i can query to find out if a feature was selected for installation in the FeaturesDlg

I am using a custom deviation from WixUI_Advanced which uses the FeaturesDlg to choose what components will be installed.  One of the components requires a Custom Action for its installation, but I do not want to run that Custom Action if I am not installing that feature.  Is there some way to query the installer session or something and build a condition for my Custom Action so that it only fires if this feature has been selected? 
Edit: I should clarify that I'm looking for language that I can use in a .wxs to determine if the feature has been selected.  Something like this, only real code that I didn't make up:
      <! --NOT REAL CODE-->
  <Custom Action="ThingToDoIfFeatureSelected"  Before="InstallFinalize">
    $(sys. MyFeatureSessionInformation. Level) > 1
  </Custom>

I know this information must exist in the session at run-time, or the installer wouldn't be able to install the correct features, but I cannot find any reference to WIX language that references this session info.  I cannot change the code in the Custom Action itself, so I need to test this condition in the WIX markup. 

A:

I found my answer.  The markup I needed for the condition was this:
<Custom Action="ThingToDoIfFeatureSelected"  Before="InstallFinalize">
  <![ CDATA[ADDLOCAL >< "MyFeatureName"]]>
</Custom>

The global variable ADDLOCAL holds a list of the features which will be installed locally.  It is a simple comma separated string, so the >< operator, which tests if the first string contains the second string, will return true if my feature is in the list.  The CDATA prevents me from having to escape the ><.  Without it, >< has to be written as &gt;&lt;
In my case, I have already limited the installation to local by adding this attribute to my feature: InstallDefault="local".  So if my feature isn't in ADDLOCAL, it isn't being installed.  If I hadn't limited the installation location, I would have to check every possible location, like this:
<Custom Action="ThingToDoIfFeatureSelected"  Before="InstallFinalize">
  <![ CDATA[ADDLOCAL >< "MyFeatureName" OR ADDSOURCE >< "MyFeatureName" OR ADDDEFAULT >< "MyFeatureName"]]>
</Custom>

Alternate Solution: I found another simpler and more exact solution for my scenario which checks the "feature-action".  The condition &MyFeatureName=3 means that this is the specific time when we are going to install this feature (it is not installed yet, and we are doing that installation now.)  Likewise, the condition MyFeatureName=2 means that this is when we will uninstall this feature (it is installed now, and we are removing it). 
More information on these conditions on this page.