Conditional formula using NULL values

Hi Experts,
Here's the background using Query Designer.
V1 = Formula Variable - Rep Path - converting master data attribute value into "number" (eg, attribute "status" = 02 becomes the number 2)
RKF1 = Sales for Day 1
RKF2 = Sales for Day 2
CKF1 = (V1 = 2) * RKF1
CKF2 = (V1 = 2) * RKF2
CKF3 = (CKF1 <> NULL) * (CKF2 <> NULL) * (CKF1 % CKF2)
My issue is with CKF3 where I need to void the entire formula for that row if EITHER CKF1 or CKF2 values are NULL.  I know in other reporting tools they have a "IS NULL" or "IS NOT NULL" operator but I know Query Designer does not.  Are there any ways around this?  This is something that needs to be dynamic which is why we can't calculate this during load time.  The values will differ depending on the variables assigned so the NULL solution seems to be the only way around this.

RKF1 = Sales for Day 1
RKF2 = Sales for Day 2
CKF1 = (V1 = 2) * RKF1
CKF2 = (V1 = 2) * RKF2
CKF3 = (CKF1 NULL) * (CKF2 NULL) * (CKF1 % CKF2)
In CKF3, you mean (RKF1 % RKF2) right? Other wise it doesnt make sense.
Could you please state what is required?
So - the formula is correct CKF3 = (CKF1 != NULL) * (CKF2 != NULL) * (CKF1 % (percentage share) CKF2)
So if CKF1 is null, then it makes the formula equal 0.  Same thing with CKF2 - if CKF2 is NULL, then it makes the formula equal 0.  Which makes 0 % 0 equal 0% which is what I want (if either CKF1 or CKF2 are null).
Edited by: Adam Rench on May 27, 2011 6:28 PM

Similar Messages

  • Using null value of item

    Hi All,
    I use this part-of-code in pl/sql statement in a 'where' clause in order to filter records to those that took place between some hours range:
    ..... and to_char(STARTDATE,'HH24:MI:SS') between NVL(:P3_HOURS_FROM,'00:00:00') and NVL(:P3_HOURS_TO,'23:59:59')
    P3_HOURS_FROM & P3_HOURS_TO are combo box items with LOV (0:00,0:30,1:00 ....etc that returns 00:00:00,00:30:00,1:00:00 respectively). I use a null value which is displayed as '--:--'.
    when i choose some hour range the rsults are correct. the problem is when i choose null values. there is no results to the report, probably (i guess) because it somehow translate the (null) time value to the same value (and it's obvious that between same time values there isn't any result).
    so i guess i use 'null' value in an inappropriate way.
    Can u tell me what do i do wrong???

    Are you sure you are returning NULL and just displaying '--:--' in your LOV?
    If the state of your LOV is becoming '--:--' then this does not equal null in PL/SQL land.
    I presume you are also submitting after changing your LOVs?
    You can check the state of your items by clicking the session state in the developers toolbar at the bottom. See what your items are being set and report back!
    Ben

  • Oracle 11.1.0.7.0 Issue with Streams when using NULL value in a key field

    Hi,
    we have an issue in our replicated environment using Streams.
    We have a replicated table using the following index:
    UK_S01_TEXT_FORMAT_TBL01 SOGID
    UK_S01_TEXT_FORMAT_TBL01 INDEX_TEXT_FORMAT_ID
    UK_S01_TEXT_FORMAT_TBL01 INDEX_LANGUAGE_LABEL
    UK_S01_TEXT_FORMAT_TBL01 INDEX_TEXT_FORMAT_COUNTER
    UK_S01_TEXT_FORMAT_TBL01 INDEX_PROVIDER_ID
    UK_S01_TEXT_FORMAT_TBL01 INDEX_TARIFF_PLAN_COSP_ID
    with field INDEX_PROVIDER_ID allowing NULL values. Actually we insert empty strings in there, but as far as I understand Oracle will convert it sliently in a NULL value, which is fine to our application.
    When we apply a change on that table (either update or delete) we get errors at streams level and the transaction is not propagated.
    Local Transaction ID: 6.28.11170
    Source Commit SCN: 25397175
    Source Commit Time: Dec-03-2012 12:21:30
    Error in Message: 1
    Error Message: ORA-26787: The row with key ("INDEX_LANGUAGE_LABEL", "INDEX_PROVIDER_ID", "INDEX_TARIFF_PLAN_COSP_ID", "INDEX_TEXT_FORMAT_COUNTER", "INDEX_TEXT_FORMAT_ID", "SOGID") = (ITALIAN, , , 0, MIKE, 124) does not exist in table
    SMS.S01_TEXT_FORMAT_TBL
    ORA-01403: no data found
    message: 1
    TableName: S01_TEXT_FORMAT_TBL
    Operation Type: DELETE
    _____ Old Data _____
    SOID : 1010000008
    SOGID : 124
    INDEX_TEXT_FORMAT_ID : MIKE
    INDEX_LANGUAGE_LABEL : ITALIAN
    INDEX_TEXT_FORMAT_COUNTER : 0
    TEXT_FORMAT : Hai raggiunto i 100MB di traffico incluso nello scatto
    APPLICA_PERIOD_CRI_ID :
    INDEX_TARIFF_PLAN_COSP_ID :
    INDEX_PROVIDER_ID :
    If I force the set of primary keys to be only the NOT NULL fields, I can successfully apply the error, but since we may have them storing both NULL and NOT NULL values, this is not a solution.
    I'm wondering why the DB on one hand converts the empty string in a NULL while inserting, but it looks the Apply process onStandby is not able to do the same when looking for the record before applying the transaction.
    Thanks in advance!
    Cheers,
    Mike

    Its showing all objects the user has permission to see- why does that need to be restricted?

  • Using null values to change text boxes

    Very simple question I believe.
    I have a form with rows of data.  All I want to do is say that if a given field in a row "description1" is not Null, then populate another field with a specified value.
    jA

    if (descriptionFieldName.rawValue != null){
      otherFieldName.rawValue = "value you want to give it";
    If there are multiple rows of this information you will have to add the row subform to the expression as well as an occurance number so it wil know which one you want . I will use i to indicate the occurance:
    if (Row(i).descriptionFieldName.rawValue != null){
       Row(i).otherFieldName.rawValue = "value you want tto give it";
    Paul

  • Error in Formula - DB Null Value

    Hi,
    I am using the following forumula to print a tax column.  I want to print 0.00 if there is no value in database.  I am using Oracle 9i.
    Blinking where the things went wrong. Please find below the formula.
    NumberVar RequiredLength:= 9;
    NumberVar CurrentLength:= Length (TOTEXT({@FICATax}));
    (IF RequiredLength < CurrentLength
    THEN TOTEXT ({@FICATax}) [1 TO RequiredLength]
    else If IsNull ({@FICATax}) Or
       InStr(TOTEXT ({@FICATax}), " ") = 0 Then
    TOTEXT ({@FICATax})
    ELSE ReplicateString (" ",RequiredLength - CurrentLength) + TOTEXT ({@FICATax}))
    FICATax
    IF 'Federal' in ({TAX_INFORMATION.TAX_DESCRIPTION_2}) then ({@TAXAMOUNT3})
    else ({@TAXAMOUNT2})
    I have also tried the below forumula,
    NumberVar RequiredLength:= 9;
    NumberVar CurrentLength:= Length (TOTEXT({@FICATax}));
    (IF RequiredLength < CurrentLength
    THEN TOTEXT ({@FICATax}) [1 TO RequiredLength]
    else If IsNull ({@FICATax}) Or
       InStr(TOTEXT ({@FICATax}), " ") = 0 Then
    '     0.00'
    ELSE ReplicateString (" ",RequiredLength - CurrentLength) + TOTEXT ({@FICATax}))
    Can any one help me out?

    Dear Salahudheen,
    Thanks for your reply.  I have tried in my report but this too not working.  Something is sitting there in the DB field, but I am not able to figure it out. 
    PFB the formula I have used in Display string part
    if ToText ({@FIRTax}) = " " or isnull({@FIRTax}) or InStr(TOTEXT ({@FIRTax}), " ") = 0  then
    "0.00"
    else totext({@FIRTax})
    I am getting values like this
        0.00
    405.00
    705.00
                     //no clue on what is here !!!!!!
    405.00
    505.00
    Edited by: KARTHI..... on Nov 3, 2009 9:24 AM
    Edited by: KARTHI..... on Nov 3, 2009 9:24 AM

  • Converting Null Values to Zero

    My report output shows expense dollars by category. In the instance where there were no expenses within a category, the output is blank/null.  Where can I put a condition to convert null values to zero for the report output?
    Angela Calhoun

    you can try doing this in Query definition by creating a formula variable.
    Thanks...
    Shambhu

  • Null Values from a Data Source

    This is more of an implementation question than a
    troubleshooting question. Also, since I've been unable to find any
    documentation on this I was wondering if anyone has come across
    this behavior or found a bug with it.
    Yesterday I was working on an application to explore some
    proof of concept aspects of Flex for an application I'm developing.
    I started running into a problem with Flex Data Services throwing
    back an 'Unknown Property: "clientaddress1"' error whenever I tried
    to update data. It seemed that whenever I tried to update a record
    in the database it would thrown the Unknown Property error. I spent
    a good chunk of the day trying to figure out what was causing this
    and finally gave up and called it a day.
    This morning I was reassessing what the problem was and
    trying to find the differences between my database and my code and
    I stumbled upon the fact that I could add no records and modify
    them without a problem, however if I tried to access an existing
    record and update it I'd get the Unknown Property error.
    I start analyzing the database and found that I'd configured
    the database to use null values for empty values and the records
    that I created with the database had null values, however, any of
    the values inserted from Flex were inserted as blank values. As
    matching my action script class as clientaddress1 = ""; So, upon
    further testing I fould that Flex was not processing the null
    values correctly, so that when it came back and rightly generated a
    Conflict Error...and then called AcceptServer() it was unable to
    find the clientaddress1 property of the class.
    Also, if any of the properties in the database are null it
    throws the same error. Basically it seems to have invalidated the
    object just because one value was null. So if all of my values from
    the DB are set to something and only one field is set to null it's
    still throwing the error on the first alphabetical item of the
    properties.
    I can resolve the problem by not using null values in the
    database, but...what sort of effect would this have on someone
    working with a large legacy database that extensively uses nulls
    for undefined values?
    Also, if a Flex guru could explain the reasoning for this
    happening I would greatly appreciate it!
    Best regards,
    Chris Maloney

    I realize that I didn't clarify that I am using ColdFusion
    for getting the data. This class was generated by the Create CFC
    wizard in Flex Builder.
    package com.generated
    [Managed]
    [RemoteClass(alias="components.generated.clients.Clients")]
    public class Clients
    public var clientid:Number = 0;
    public var clientfirstname:String = "";
    public var clientlastname:String = "";
    public var clientaddress1:String = "";
    public var clientaddress2:String = "";
    public var clientcity:String = "";
    public var clientstate:String = "";
    public var clientzip:String = "";
    public var clientphone:String = "";
    public var clientemail:String = "";
    public function Clients()
    }

  • NULL Value in Journal Entry and Wrong Tax Summary

    Hi people,
    I need your expert help for a big problem that appens to some customers.
    They run SAP BO 8.8 SP:00 PL:12
    This is the scenario:
    You insert a new documet,  A/R Invoice or A/P Invoice is the same, problem appear in all of them.
    After you insert the document, using SQL Server Management try this Select statment:
    Select * from JDT1 where JDT1.debit is null OR JDT1.credit is null
    A list of record where listed. And, this is the problem, NULL values are all in the VAT Lines in debit or credit colums.
    If you try to make a SUM(debit-credit) you discovery that, 1000,00-null=null
    Consequently, TAX Sumary report, that probably use arithmetic operation like me in SELECT statment,  count a wrong number when null values in DEBIT or CREDIT column in JDT1 for VAT declaration.
    How could I solve? And how i can make invoices store 0 rather than NULL in the VAT Line?
    Thanks in advance for your tips and solutions

    Thaks Neetu for your answer.
    I thinks there is a misurandertanding.
    My problem is not SQL.
    My problem is the SAP TAX Report.
    I used SQL only for check data and discover why SAP raise a wrong TAX Summary report.
    So, my question is: Why invoices write null values in journal entry, and how I can solve the problem that TAX summary report use null value in operations so the results are wrong.
    Thanks,
    Jonny Cortonicchi

  • Decision expressions & null values

    How to use null values in a decision expression in decision node in jpd process?
    I need something like
    $emailMetaData/ns0:Attachments != NULL
    Thank you

    Hello
    While that is true for a unique index on columns where all values are null, it is not the case where one of the values is not null:
    SQL> CREATE TABLE dt_test_nulls (id number, col1 varchar2(1))
      2  /
    Table created.
    SQL> CREATE UNIQUE INDEX dt_test_nulls_i1 on dt_test_nulls(id)
      2  /
    Index created.
    SQL> insert into dt_test_nulls values(null,'Y')
      2  /
    1 row created.
    SQL> insert into dt_test_nulls values(null,'N')
      2  /
    1 row created.
    SQL> create unique index dt_test_nulls_i2 on dt_test_nulls(id,col1)
      2  /
    Index created.
    SQL> insert into dt_test_nulls values(null,'N')
      2  /
    insert into dt_test_nulls values(null,'N')
    ERROR at line 1:
    ORA-00001: unique constraint (BULK1.DT_TEST_NULLS_I2) violated
    SQL> insert into dt_test_nulls values(null,null)
      2  /
    1 row created.
    SQL> insert into dt_test_nulls values(null,null)
      2  /
    1 row created.I just thought it was worth pointing out.
    HTH
    David
    Message was edited by:
    david_tyler

  • Using "Where" operator sometimes generates a Null Value

    Hello,
    I am struggling with the following problem:
    Sometimes when I use the "Where" operator, I get a Null value that I can't get rid of.  For example:
        [Fiscal Quarter] Where [Fiscal Quarter] = "2009 Q3"
        Returns:    "2009 Q3"  and [Null]
        Note:  The object [Fiscal Quarter] is a dimension.
    Conversely, when I use this formula:
        [Revenue] Where [Fiscal Quarter] = "2009 Q3"
        There is just one result, e.g., $100,000, as expected.
    Is there something I can add to the first formula so that I do not get the Null response?
    thanks so much,
    Helen Gonzalez

    Hello, Ekta!
    in response to your help:
    Q:  Is the query that is the value of the Fiscal Dimension dependent upon some other condition?
    A:  No, the dimension "[Fiscal Quarter]" is not dependent on anything else. 
    Q:  Have you tried breaking the formula to smaller chunks?
    Have you tried using other Conditional Operator as "Nested IF".
    A:  No, I haven't tried that.  Any suggestions?  It sounds reasonable.
    Thanks,
    Helen

  • Handling null value in where condition

    CREATE OR REPLACE package body GetRefCursors is
    function sfGetAccountInterval
    ( pFirstAccount in ACCOUNTS.ACCOUNT_NO%type
    ,pLastAccount in ACCOUNTS.ACCOUNT_NO%type)
    return csGetResultSet is
    csGetAccounts csGetResultSet;
    begin
    open csGetAccounts for
    SELECT accounts.account_no,accounts.name
    FROM accounts
    WHERE accounts.account_no BETWEEN pFirstAccount AND pLastAccount
    ORDER BY accounts.account_no;
    return csGetAccounts;
    end sfGetAccountInterval;
    end GetRefCursors;
    how can i handle the condition if pFirstAccount parameter having null value?
    do i need to use Dynamic SQL here?

    no need for dynamic stuff.
    You could use the NVL function, but it depends what you want... If you want NULL to be considered the lowest possible account number, then you could do something like
    nvl (pFirstAccount, 0)where the zero is the lowest possible number.

  • Using NULL in Condition Object

    Is there are way to use the value NULL in the Condition object. For example, the following does not work because I really need "U_PLS_SysU IS NULL" for my query to work:
    conditions = new SAPbouiCOM.Conditions();
    condition = conditions.Add();
    condition.Alias = "U_PLS_SysU";
    condition.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;
    condition.CondVal = "NULL";
    This statement gets interpreted literally of course and does not return the correct rows. Is there a workaround?
    Thanks

    It´s just a guess, but... have you tried something like an SQL injection?
    Some trick like:
    conditions = new SAPbouiCOM.Conditions();
    condition = conditions.Add();
    condition.Alias = "U_PLS_SysU";
    condition.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;
    condition.CondVal = "   '' OR U_PLS_SysU IS NULL";
    //There are 2 single quotes begore OR word
    If it was well designed it shouldn´t work, but you never know...
    Regards,
    Ibai Peñ

  • Check for null values in conditional formatting when no rows returned.

    I have a report that is showing facts for different months.
    For some months there is no row in the facts table.
    But in the report, I have to show a * when there is no data.
    If there is a row in the facts table with null value for data, the conditional formatting successfully shows a * when data is null.
    But when no row is present in the facts for a particular month , conditional formatting is unable to detect any null, as none exist.
    How we can check that no rews returned for a particular month and then show *?
    thanks

    Hi,
    which obiee version r u using?
    My Blog ref:
    http://obieeelegant.blogspot.com/2011/06/replacing-null-as-0-in-obiee.html
    in obiee10g its working fine.expect obiee11g
    also see the bug reference
    How to replace null as 0 in  obiee11g pivot table view?
    obiee11.1.1.6.0 also have the same issues.
    Thanks
    Deva

  • Issue with 'null' value in Formulas

    Hi all - I have a PDF in which I'm performing various calculations, basic addition and subtraction.  I'm using the following Custom Calculation Script:
    this.getField("Amount, Total Revenue Allocated to Maintenance Expenses").value = this.getField("Amount, Endowment Care Fund Income - Schedule H").value + this.getField("Amount, Special Care Fund Income - Schedule H").value + this.getField("Amount, Income from Cemetery Operations").value + this.getField("Amount, Other Sources Please Specify").value;
    My issue is that when someone deletes a value in one of the fields (which I guess causes the field to be 'NULL'), the calcualtion doesn't work....so in other words if I have the following:
    Field 1:  10
    Field 2:  20
    Field 3:  30
    Field 4:  40
    When adding this should result in 100.....however if one were to delete the value in field 2, my calcualtion then produces 103,040....the formula doesn't know how to process the NULL value of course, so it concatenates the numbers.
    How do I get around this?  Do I need more JavaScript, and if so is there a good example somewhere on how to code it?
    Thanks, Steve

    leahfst,
    If these dates are complementary (as in 'either date1 either date2 has a value) you could transform the dates to text, merge these two fields (one being empty) and convert the result back to a date:
    Date(ToText({CnFGf_1.CnFGf_1_Date}) & ToText({CnFGf_2.CnFGf_2_Date}))
    If these dates can both have a value (or not), it is helpful to know a null-value for dates is equal to Date(0000,00,00). In this situation, there can be the following situations:
    1. Both dates are empty. Your result will obviously be an empty date.
    2. {CnFGf_1.CnFGf_1_Date} has a value, {CnFGf_2.CnFGf_2_Date} is empty.
    3. {CnFGf_1.CnFGf_1_Date} is empty, {CnFGf_2.CnFGf_2_Date} has a value.
    4. Both dates have a value. You will have to choose which date should be used.
    For any of these four situations, you can check the date to have a value using:
    IF {CnFGf_1.CnFGf_1_Date} = Date(0000,00,00)
    and so on..

  • Using null to replace values

    I'm a newbie! Can you tell me how can replace existing values in a variable. My plot in the program is to have the price of products in my right hand then transfer that to the cart and then to cashier lady. I have to make sure and know that when I transfer the price from my right hand to the value cart the right hand should no value, then when from cart to the cashier the cart should have no value. The code below is not yet finish. I'm just testing it on one product. I just to know the transferring concept. Can I use null?
    This my are codes:
    the customer class
    public class customer{
         String fullName,walletName;
         double wallet,money;
         public void sayName(){
              System.out.println(fullName + " is inside the grocery");
         public String giveFullName(){
              return fullName;
         public void sayWalletBrand(){
              System.out.println("Let me see how much money I got from my " + walletName + " wallet\n");
         public void contentWallet(double money){
              wallet = money;
         public void lookWallet(){
              System.out.println("Show that wallet has the value " + wallet);
              System.out.println();
    the product class:
    public class product{
         String description;
         double price,rightHand;
         public double containRightHand(){
              rightHand = price;
              System.out.println(rightHand);
              System.out.println();
              return rightHand;
         public void showDescription(){
              System.out.println("Show product description " + description);
         public void showPrice(){
              System.out.println("Show the product price value " + price);
              System.out.println();
    the cart class:
    public class cart extends product{
         double contents[] = new double[2];
         product doritos,apple;
         //Movement method from rightHand to cart
         public double getProduct1(product doritos){
              contents[0] = doritos.containRightHand();
              return contents[0];
         public double getProduct2(product apple){
              contents[1] = apple.containRightHand();
              return contents[1];
         public void showProduct1(){
              System.out.println("Show that contents[0] has the value "+ contents[0]);
         public void showProduct2(){
              System.out.println("Show that contents[1] has the value "+ contents[1]);
    the cashier class:
    public class cashier{
         customer cashierLady;
         public void tellNameCashier(customer cashierLady){
              System.out.println("Shows the name of the cashier lady named " + cashierLady.giveFullName());
    the main:
    public class grocery{
         public static void main(String []arg){
              customer Peter, Lady;
              Peter = new customer();
              Peter.fullName = "Raymond Malicdem";
              Peter.walletName = "Seiko";
              Peter.wallet = 1000.0;
              Peter.sayName();
              Peter.sayWalletBrand();
              Peter.contentWallet(1000.0);
              Peter.lookWallet();
              product Doritos = new product();
              Doritos.description = "Junk Food";
              Doritos.price = 60.0;
              Doritos.showDescription();
              Doritos.showPrice();
              Doritos.containRightHand();
              cart product1 = new cart();
              product1.getProduct1(Doritos);
              product1.showProduct1();
              Lady = new customer();
              Lady.fullName = "Christine";
              cashier lady = new cashier();
              lady.tellNameCashier(Lady);

    Variables of object (class) types may be set to null, meaning they point to no object.
    Variables of fundamental types (int, byte, char, long, double, float, boolean, etc.) can not be set to null. Maybe you can set your numeric types to 0 and boolean to false, to indicate nothingness.

Maybe you are looking for

  • NB500: How to use the Recovery DVD without a DVD drive in the netbook?

    Background: I have a Netbook NB 500 which came with a Win7 Starter. I upgraded to Win8 but didn't like it as the screen resolution wsn't high enough to open Apps. As the system became slower and slower over time, I decided to reset the unit back to o

  • Home sharing issue

    I updated to the new iTunes yesterday.........everything was fine in home sharing but today the shared folder for photos in iTunes is not showing up on atv2 although it is accessing them for the scrensaver........go figure.......please any suggestion

  • Need external antenna connector for old Nokia 5110...

    Hi all, this is a long shot I admit, but doesn anyone know what type of connector (and where to purchase) was used on the old 5110/6110 Nokia phones, it is the external connector located on the rear behind the rubber grommit use for the car kits... I

  • "Boot OS X" and "EFI" mounted on desktop - why?

    Hi there, I've just rebooted my MBP (10.10.1) and have these new additions to my desktop. Any idea how I get rid of them? Many thanks

  • Data modelling - counter scenrio

    I need to report counters for no of sales orders on delivery block, incomplete orders and billing blocks and count backorder line items. I have a DSO mapped with VAITM, key fields sales doc and item no. I have all - delivery block, incomplete orders