Deref column name calculated from text expression?

I have 3 email lists stored as virtual columns and I want to have 1 (rather than 3) notification workflow which will access the proper list and I am trying to use an expression like this in the To: field of the email task in my workflow to select the proper email list:

[Participant ID].[CONCATENATE("Notify Emails ",
    IF([_STATE]=Referral,
        "Referral",
        IF([_STATE]=Application,
            "Application",
            "Application Decision",
        )
    )
)]

However it just blats this text as an email address.

Is it disallowed to calculate a column name like this? If so, where is the documentation on this expression restriction?

Also I noticed a bug, when there is a missing ) inside of the square brackets it does not get flagged when saving the expression (I removed the last closing paren from the same expr as above):

[Participant ID].[CONCATENATE("Notify Emails ",
    IF([_STATE]=Referral,
        "Referral",
        IF([_STATE]=Application,
            "Application",
            "Application Decision",
        )
    )
]
Solved Solved
0 5 218
1 ACCEPTED SOLUTION

Thanks Steve for leading me to the correct solution, I just simply didnโ€™t think to inside-out the expression, here is my solution:

SWITCH(
    [_STATE],
    "Referral",
      [Participant ID].[Notify Emails Referral],
    "Application",
      [Participant ID].[Notify Emails Application],
    [Participant ID].[Notify Emails Application Decision]
)

View solution in original post

5 REPLIES 5

Steve
Platinum 4
Platinum 4

Nope.

Itโ€™s not a โ€œrestrictionโ€. Youโ€™ve misunderstood what a dereference is.

Thanks for the quick reply. Thatโ€™s good news that we can compute column names, how would I restructure my expression to do what I need to?

Try:

CONCATENATE(
  "Notify Emails ",
  SWITCH(
    [_STATE],
    "Referral",
      [Participant ID].[Referral],
    "Application",
      [Participant ID].[Application],
    [Participant ID].[Application Decision]
  )
)

I believe you have a misunderstanding of what @Steve had said: you cannot dynamically compute column names. Itโ€™s totally inposibble in terms of many programming and RDBMS reasons.

Thanks Steve for leading me to the correct solution, I just simply didnโ€™t think to inside-out the expression, here is my solution:

SWITCH(
    [_STATE],
    "Referral",
      [Participant ID].[Notify Emails Referral],
    "Application",
      [Participant ID].[Notify Emails Application],
    [Participant ID].[Notify Emails Application Decision]
)
Top Labels in this Space