Formula field

  • Can I have setup a column formula for a field only for some rows...

    Eg:

    If column1='x' then apply formula for column2 else column2="value inserted from the application"


    Kindest Regards,

    Joel

  • I dont think so. You can however have a trigger fired up to apply the formula if the value inserted is 'X'.

    ******************
    Dinakar Nethi
    Life is short. Enjoy it.
    ******************

  • If this is an issue for data insert update, I have always been a proponent of stored procs in place of INS/UPD/DEL statments.  Then the insert proc takes all columns as parms and evaluates/modifies before insertion.  (I hate triggers, but yeah they can do that).

    If it is a selection issue you can create a view that users use for reporting that remaps column2:

    create view tablexview as

    SELECT column1, CASE WHEN column1='x' THEN 'ABC' ELSE column2 END AS column2

    FROM tablex

     

  • CASE WHEN column1='x'

    then formula 

    else 'value inserted from the application'

    END

    _____________
    Code for TallyGenerator

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply