Custom Action - Retrieve field whose value is a variable

Hi -

   BACKGROUND

  We are using FB 5 Professional.

  I have a custom action that has a few fields.   The fields can be set to a variable.

   In my C# class which implements the custom action how can I tell if a field is set to a variable? 

  For example, in my OnExecute() method I have the following code....

  string sSourceFolder = Context.Properties.get_PropertyAsString("SourceFolder").ToString();

   ASSUMPTIONS

   If sSourceFolder begins and ends with a percent (%) then I know the user set the value of the field to a variable.

   When this is the case I can use Context.GetVariable(sSourceFolder.Replace("%","")  to get the value to use in my code.

   If sSourceFolder does not begin and end with a percent then I know the value entered is not a variable.

  Can any verify if my assumptions are correct?    

  If my assumptions are correct, then I also need to take into account the situation where the user specifies multiple variables in a field.     For instance, if the user set a field to %RootDir%\%Current Folder% then I would need to parse out the value and retrieve both variable values using the GetVariable() method.

  Thanks 

Hi Rob

Context.ExpandExpression is what you need to call. This will evaluate any variable references and provide the correct value back.