SSIS Derived column Transformation setting to BOOL with UPPER(LTRIM(RTRIM

SSIS Derived column Transformation setting to BOOL with UPPER(LTRIM(RTRIM

我有一个需要设置为 1 或 0 的标志。所以我使用派生列转换将其转换为布尔值 因为您可以看到代码,只有当我对 Y 和 N 使用 OR 运算符时它才有效。 下面的代码适用于 IF Flag is Y and N condition

(DT_BOOL)(Flag == "Y" ? 1 : 0) || (DT_BOOL)(Flag == "N" ? 0 : 1)
** working only when FLAG = (Capital)Y OR N *****************

但是如果我的 Flag 很小 'n' 它不起作用它仍然设置为 TRUE 我想同时将其设置为 UPPER 和 TRIM。我很难弄清楚。 这是我的代码,但它不起作用

(DT_BOOL)(UPPER(RTRIM(LTRIM
    (Flag == "Y" ? 1 : 0)
)))
   ||(DT_BOOL)(UPPER(RTRIM(LTRIM(Flag == "N" ? 0 :1)
))) ***** this code is not working *****************

感谢您的宝贵时间。

PLEASE look at Tranformation Pic

试试这个...

(DT_BOOL)(UPPER(RTRIM(LTRIM(Flag))) == "N" ? 0 :1)