嵌套三元组,无法发现错误

时间:2014-11-26 23:39:52

标签: ssis nested ternary-operator

我在SSIS中有这种嵌套的三元表达式,我似乎无法开始工作,我的眼睛即将从我的头骨中出来。

FINDSTRING(TRIM(f3),"BASICS",1) != 0 ? (UPPER(LEFT(TRIM(f3),1)) == "F" ? @[User::FallBasicsEntityId] : (UPPER(LEFT(TRIM(f3),1)) == "S" ? @[User::SpringBasicsEntityId] : @[user::BasicsEntityId])) : (UPPER(LEFT(TRIM(f3),1)) == "F" ? @[user::FallEntityId] : (UPPER(LEFT(TRIM(f3),1)) == "S" ? @[user::SpringEntityId] : @[user::DefaultEntityId]))

这是"缩进"版本:

FINDSTRING(TRIM(f3),"BASICS",1) != 0 
    ? (
        UPPER(LEFT(TRIM(f3),1)) == "F" 
        ? @[User::FallBasicsEntityId] 
        : (
            UPPER(LEFT(TRIM(f3),1)) == "S" 
            ? @[User::SpringBasicsEntityId] 
            : @[user::BasicsEntityId]
          )
      ) 

    : (
        UPPER(LEFT(TRIM(f3),1)) == "F" 
        ? @[user::FallEntityId] 
        : (
            UPPER(LEFT(TRIM(f3),1)) == "S" 
            ? @[user::SpringEntityId] 
            : @[user::DefaultEntityId]
          )
      )

我错过了什么?在我看来,括号是平衡的并且放置得恰当......或者是它们?

我即将抛弃这个并使用脚本组件......在我看来,这样的表达式更容易用C#代码维护...

1 个答案:

答案 0 :(得分:2)

括号是平衡的;问题是userUser不同。