Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Your original expression</p> <pre><code>((DT_UI1)products_status == (DT_UI1)4) || ISNULL(prod_status) ? (DT_UI1)4 : (DT_UI1)prod_status </code></pre> <p>returns a boolean. Let's assume products_status is 4 and prod_status is also set to 4.</p> <pre><code>((DT_UI1)products_status == (DT_UI1)4) </code></pre> <p>Evaluates as TRUE.</p> <pre><code>ISNULL(prod_status) ? (DT_UI1)4 : (DT_UI1)prod_status </code></pre> <p>Evaluates as 4.</p> <p>Your original expression now evaluates as</p> <pre><code>TRUE || 4 </code></pre> <p>Which evaluates to</p> <pre><code>TRUE </code></pre> <p>Which when you try to stick it in an integer column like products_status becomes 1.</p> <p>Your first revision makes no substantive change to the evaluation chain and also returns TRUE (i.e. 1).</p> <p>Your second revision is the correct formulation of the ternary operator, as is the final base test. However, it appears that ISNULL(prod_status) always returns FALSE in your case since you are explicitly setting it to 4 or 1 in your other derived column, so let's ignore your second revision and just go to your final base test.</p> <p>With regards to your final base test, I would definitely:</p> <ul> <li>Attach a Data Viewer before your Derived Column component to ensure that the products_status column being passed in is indeed set to 4</li> <li>Set a Data Viewer after your Derived Column component to see that products_status has been set (or not set) properly;</li> <li>Make sure that you properly mapped the products_status field to your database destination and not the prod_status field by mistake.</li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload