Setting an expression dynamically

11. October 2008 11:53 by Dougbert in   //  Tags:   //   Comments (1)

Former Integration Services developer Michael Entin recently responded to an interesting question on the internal SSIS discussion list at Microsoft. The user was asking: How can I assign the expression [in this case, for the Derived Column transformation] dynamically at run time?

The intuitive but less-than-obvious answer is...use an expression to set the expression! This lets you put your expression in a string variable such as @User::DerivationRule, and assign that by using an expression to the FriendlyExpression property that you want to set.

Remember that you find expressionable properties for data flow components on the containing Data Flow task, and not on the individual component. 

Let's walk through the scenario.

  1. User wants to create a Derived Column but assign the formula that determines the column's value at run time.
  2. Go to properties of containing Data Flow task, Expressions, and open Property Expressions Editor.
  3. Select and edit FriendlyExpression property of appropriate property. For example:

 

If you're interested in the possibilities here, you may want to glance at the BOL topic:

Data Flow Properties that Can Be Set by Using Expressions

-Doug

Comments (1) -

Jamie Thomson
10/11/2008 4:22:44 PM #

Doug,


This is a strange one isn't it? As I said about a while back "The result of the expression has to be, in itself, a valid expression" (blogs.conchango.com/.../...taflow-expressions.aspx">blogs.conchango.com/.../SSIS_3A00_-Dataflow-expressions.aspx).


Slighty bizarre really!


-Jamie


Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading