Add minus into SSIS expression

Christopher Jack 1,616 Reputation points
2020-12-07T13:47:15.44+00:00

Hi,

I have the folllowing expression in SSIS

PaymentValue > 999999.00 ? 999999.00 : PaymentValue

How would I also add if it is -999999.00 , sort of like an or statement.

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,016 questions
SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,593 questions
{count} votes

Accepted answer
  1. Michael Taylor 54,901 Reputation points
    2020-12-07T15:28:36.443+00:00

    Depends on what you want to do but I suspect that any # less than 0 should be negated (e.g. -50 should be 50). In that case you can use ABS() function.

       vb  
       ABS(PaymentValue)  
    

    If you want to simply combine multiple conditions using logical AND and OR then you can do that as well with logical operators.

       vb  
       (PaymentValue < 0) || (PaymentValue > 99999)) ? 0 : PaymentValue  
    
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Monalv-MSFT 5,901 Reputation points
    2021-01-01T06:46:06.567+00:00

    Hi @Christopher Jack ,

    Could you please share the example data of the source data and your desired output?

    Please refer to the following expressions and pictures:

    1. Derived Column1:
      (DT_NUMERIC,10,2)[PaymentValue ] > -999999.00 ? -999999.00 : (DT_NUMERIC,10,2)[PaymentValue ]
    2. Derived Column1:
      ABS((DT_NUMERIC,10,2)[PaymentValue ]) > 999999.00 ? 999999.00 : (DT_NUMERIC,10,2)[PaymentValue ]

    52699-source.png
    52597-derivedcolumn.png
    52598-result.png

    Best Regards,
    Mona

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.