Proper use of the sum function of Expression

I want to get the sum of three number fields and use the value in a between function of ReportQuery as part of the selection criteria. I have tried a number of ways to do this, but can't seem to get it correct. Can some give me some code examples as to how to do this.
Thanks,
Jay

You should be able to use the ExpressionMath.add() API to do this.
i.e.
Expression sum = ExpressionMath.add(ExpressionMath.add(eb.get("salary"), eb.get("raise")), eb.get("bonus"));

Similar Messages

  • XML Data template. Using the SUM() function

    Hi there,
    I have a data template where I want to create a summary column based on the child group.
    *<group name="G_RO_ESTIMATES" source="Q_RO_ESTIMATES">
    <element name="ESTIMATE_TOTAL" value="G_RO_ESTIMATE_LINES.CHARGE" function="SUM()" />
    <group name="G_RO_ESTIMATE_LINES" source="Q_RO_ESTIMATE_LINES">
    <element name="CHARGE" value="CHARGE" />
    </group>
    </group>*
    ESTIMATE_TOTAL returns 0
    even though the value of the CHARGE column is 760.
    I got the SUM() function to work on another group further down in my data template but for some reason this will not work.
    Does anyone have a clue on what's wrong?
    Thank you in advance.
    BR Kenneth

    give the name of the element diff as CHARGE_TEST
    *<group name="G_RO_ESTIMATES" source="Q_RO_ESTIMATES">
    <element name="ESTIMATE_TOTAL_TEST" value="G_RO_ESTIMATE_LINES_GRP.CHARGE_TEST" function="SUM()" />
    <group name="G_RO_ESTIMATE_LINES_GRP" source="Q_RO_ESTIMATE_LINES">
    <element name="CHARGE_TEST" value="CHARGE" />
    </group>
    </group>*
    sometimes the name get overlapped which results in zero.. keep the names unique
    (i guess , i already logged a bug for this sometime back)

  • The sum function requires 1 argument(s).

    ---Hi i am trying get all of
    (sum(Q.SCTOTAL,0)) as SC,
    (sum(Q.SRTOTAL,0)) as SRTOTAL,
    (sum(Q.CminusREF,0))as CminusREF,
    (sum(Q.SFAT,0))as SFAT,
    (sum(Q.SPAT,0))as SPAT,
    (sum(Q.SNOTATPT,0))as SNOTATPT,
    (sum(Q.SET,0))as SET,
    (sum(Q.TOTAV,0))as TOTAV
    and for each emp_name?
    but it is not wotking for me. the error says: The sum function requires 1 argument(s).
    what shoould i change on the code below so mY Query can Run?
    thank you
    B.
    select distinct
    G.Emp_name,
    upper(G.EMP_case_number) as MIS_EMP_case_NO,
    G.Emp_name as Emp,
    G.MIS_Emp_id,Radius,
    G.address,
    G.DC as Emp_DC,
    G.Emp_class,
    Q.YEAR,
    Q.EMP_case_number,
    (sum(Q.SCTOTAL,0)) as SC,
    (sum(Q.SRTOTAL,0)) as SRTOTAL,
    (sum(Q.CminusREF,0))as CminusREF,
    (sum(Q.SFAT,0))as SFAT,
    (sum(Q.SPAT,0))as SPAT,
    (sum(Q.SNOTATPT,0))as SNOTATPT,
    (sum(Q.SET,0))as SET,
    (sum(Q.TOTAV,0))as TOTAV
    FROM tbl_MIS_QC G
    LEFT JOIN QCPFA Q ----View
    ON upper(Q.EMP_case_number) = upper(G.EMP_case_number)
    where DC = '55'
    gorup by G.Emp_name
    order by G.Emp_name, upper(G.EMP_case_number)

    Hi,
    It's true: the SUM function only takes one argument. What are you trying to do with the second argument, 0?
    When you use aggregate functions (like SUM), everything in the SELECT clause must be an aggregate function, a constant, or one of the GROUP BY columns. Without knowing your tables, your data, or what results you want, I can't tell you exactly what to do. You might want to compute the SUMs in a sub-query before joining them to the other table, something like this:
    select  G.Emp_name,
            upper(G.EMP_case_number) as MIS_EMP_case_NO,
            G.Emp_name as Emp,
            G.MIS_Emp_id,Radius,
            G.address,
            G.DC as Emp_DC,
            G.Emp_class,
            Q.YEAR,
            Q.upper_EMP_case_number,
            q.sc,
            q.srtotal,
    FROM    tbl_MIS_QC G
    LEFT JOIN
            (   -- Begin in-line view q
            SELECT  year,
                    UPPER (emp_case_number) AS upper_emp_case_number,
                    sum(SCTOTAL) as SC,
                    sum(SRTOTAL) as SRTOTAL,
            FROM    QCPFA
            GROUP BY  year,
                      UPPER (emp_case_number)
            )   -- End in-line view q
    ON Q.upper_EMP_case_number = upper(G.EMP_case_number)
    where DC = '55'
    order by G.Emp_name, upper(G.EMP_case_number) Repeat: this is just a wild guess, the best I can do without seeing some test data and the results you want from that data.

  • Why does the sum function not work when I try to add a column of decimal numbers?  The value is always returned as 0.  No problem with whole numbers but decimals do not work!

    just bought a MacBook Air and using Numbers to make a spreadsheet for financial purposes.  The sum function is working ok for whole numbers but when I try to sum a column of 2 decimal place numbers the result always comes back as 0.  Can anyone help?

    Hi laura,
    I suspect that your 2 decimal place numbers are formatted as text. Change the format of the column to currency and see it that works.
    Also You might want to update your profile to reflect your current systems!
    quinn

  • Inverse of the Sum function

    Post Author: deejayw
    CA Forum: Formula
    Hi,I am trying to create a formula which works like the Sum function but will give me the difference between two amounts.Scenario:Each record has a username, invoice date and invoice amount. My data set contains two months of data which means for each username, i have two invoice amounts and invoice dates. I know the Sum function will add values together but how can i get the difference between two values, namely last months invoice amount and this months invoice amount (order is important).Do i need to use an array or is my brain so fried that i'm missing something simple?Thanks 

    Post Author: satyanat
    CA Forum: Formula
    Hi,
    Instead of having the two months invoice details in a single query you can write it as two queries, one to pull the current month invoice date,amount and the other one to pull the previous month Invoice. you can link both queries on User name through visual link.
    Now you can easily find the difference between the two invoice amounts.
    ex: {previousmonth.invoiceamt} - {currentmonth.invoiceamt}
    Try this option.
    Regards,
    Natarajan

  • In Numbers, how do I lock in the date and time data when an IF/THEN formula is used with the "NOW" function?

    In Numbers, how do I lock in the date and time data when an IF/THEN formula is used with the "NOW" function?
    =IF(I127,NOW()," ")
    I127 equals a check box. The formula retuns a value of the current date and time when a check is placed in the box. How does one lock that date and time so that it cannot be changed?

    I don't think it is possible to lock in the date and time using a formula. You could put NOW() in a cell, copy, and Edit Paste Formula Results where you want the result.
    Or if you are "time stamping" a lot, you may find this Automator Service (Dropbox download) helpful. It puts a "Today" function (actually it should be named "Now" because it includes both date and time) in your Services menu like this:
    Just doubleclick the .workflow package to install it. You may have to click "download anyway" in System Preferences > Privacy & Security.
    If you want you can assign the service a keyboard shortcut in System Preferences here:
    SG

  • How can I sum up raws? the sum function seems to work for columns only and right now I have to create a separate formula for each raw

    How can I sum up raws? the Sum function seems to work only on columns. Right now I have to create a separate formula for each raw

    Hi dah,
    "Thanks, but can I do one formula for all present and future raws? as raws are being added, I have to do the sum function again and again"
    You do need a separate formula for each group of values to be summed.
    If the values are in columns, you need a copy of the formula for each column.
    If the values are in rows, you need a copy of the formula for for each row.
    If you set up your formulas as SGIII did in his example (shown below), where every non-header row has the same formula, Numbers will automtically add the formula to new rows as you add them.
    "Same formula" in this context means exactly the same as all the formulas above, with one exception: the row reference in each formula is incremented (by Numbers) to match the row containing the formula.
    Here the formula looks like this in the three rows shown.
    B2: =SUM(2)
    B3: =SUM(3)
    B4: =SUM(4)
    That pattern will continue as rows are added to the table.
    Also, because the row token (2) references all of the non-header cells in row 2, the formula will automatically include new columns as they are added to the table.
    Regards,
    Barry

  • How does one install non-English character sets for use with the "find" function in Acrabat Pro 11?

    I have pdf files in European languages and want to be able to enter non-English characters in the "find" function. How does one install other character sets for use with Acrobat Pro XI?

    Have you tried applying the update by going to Help>Updates within Photoshop Lightroom?  The update should be using the same licensing?  Did you perhaps customize the installation location?  Finally which operating system are you using?

  • Use of the Earlier function

    Hi Everyone
    I am trying to use the Earlier function to get the value of the previous row for the function referenced. I keep getting the below error for its use in the second half of the If statement. I am using Earlier with a function and not a column so I am not sure
    if that is the issue or something else. I tried it using a '2' instead of a '1', but that didn't help.
    Does anyone know anything about this?
    Function:
    =if(earlier([Numerator-new],1)<>0,earlier([Numerator-new],1),0)
    Error:
    "Calculation error in measure 's1Perm1'[Calculated field 1]: EARLIER/EARLIEST refers to an earlier row context which doesn't exist."

    This is somewhat complicated, but this logic would work:
    a. If the ExitMonth > 6 then get the record where the ExitMonth is 3 months less than the current record (if it exists) and where the JudgeName, JudgeTitle and Year fields are the same as the current record.
    b. If the ExitMonth > 1 and  ExitMonth < 6 then get the record where the ExitMonth is 1 month less than the current record (if it exists) and where the JudgeName, JudgeTitle and Year fields are the same as the current record.
    c. If the ExitMonth =1 then get the record where the ExitMonth =.5 and where the JudgeName, JudgeTitle and Year fields are the same as the current record.
    I am attaching a screenshot below (with info redacted) of a few records that represent what this looks like.

  • Table format used in the 'sums' table

    Hello,
    If you ask numbers to insert a table of the type 'sums', then a table is inserted which has a a thick white line above the last row.
    I have many tables and I would like to format them like the sum table.
    Therefore, I would like to know how I can insert a thick white line above the last row?
    Thanks,
    Sanjay

    Please open Numbers then click Help > Numbers User Guide, it contains much useful information. If after doing all that you cannot find your question or an appropriate answer to your question then by all means come back and ask your question. We'll be pleased to assist you.
    These discussions are user to user, not Apple employees answering the question. Questions will be answered as a user such as yourself finds time, desires to, or is willing to respond.
    Welcome to Numbers discussions, have fun.
    Sincerely,
    Yvan KOENIG (from FRANCE dimanche 2 novembre 2008 11:28:16)

  • Tables used in the system function call

    Hi expert,
    I want to find out which are the tables used to extract data using system function call on SAP 3.1h system.
    here is my specification.
    I am using "AUTH_FIELD_GET_INFO" function module to get describtion of attribute
    say for example
    import parameter to this function module
    Fieldname : VIEW
    langu     : E
    and return parameters are DATEL,INTTYPE,LNG,RC,TEXT.
    where in this function module there is system funcation call which return text for fieldname pass to this function
    system function name:<b>C_DD_READ_FIELD</b>
    can any one tell me which are tables used in the above system function.
    Regards
    John.

    hi,
    goto: system-utilities- debug system
    A.
    Message was edited by: Andreas Mann

  • Proper use of the term "Podcast"

    A media company recently started advertising that they "Podcast" recent shows. In reality, they offer a program that listeners can down load and install. From there, the software allows you to access, listen to and save mp3 files to one's hardrive. From there, they can be imported to iTunes.
    Their files are not accessible directly from iTunes in the Podcast section of the Music Store.
    Is this a proper and legal use of the term "Podcast"?

    As I understand it, a podcast is something that is automatically fetched from the Internet and added to your portable audio player, most often via RSS to iTunes to iPod. The term "podcast" existed before Apple built the feature right into iTunes, so despite the fact that the name refers to iPods, the term isn't limited podcasts listed in the iTunes Music Store.
    In this specific case, I think you're correct in your assumption. Since it doesn't sound like the new episodes are fetched automatically nor are they automatically synched with a portable audio player, I don't think the term "podcast" should be used. However, people misuse computer terms all the time, even big media companies, so I wouldn't get too upset about it.

  • MIGO use of the HOLD function

    HI Experts
    I have a requirement that the user will use a approval while posting MIGO.
    f.e. the tolerance checks failes and MIGO doesn´t allow to post. This is the trigger to ask the next higher person for approval to allow a higher tolerance.
    My Idea was to use the hold function.
    I will use BADI MIGO_GR_CHECK (MB_MIGO_BADI) Method HOLD_DATA_SAVE.
    But the problem is that I need the current information from MIGO (later MSEG/MKPF).
    Do you know how to get the information?
    The Paramter I can use in this method is just I_GUID.
    I know there is a sample coding, but this doesn´t help.
    Thanks
    Alex
    Edited by: Alexander Stappert on Mar 12, 2010 10:07 AM

    Solved

  • Using ABS and Sum function at a time

    <?if: sum(ARCH_AMT)!='0' ?>
    we were using above condition in the template to restrict data till date,but we were facing a new problem when ARCH_AMT is having multiple lines with same amount but +ve and -ve i.e 500,-500 it's doing sum and not returning data since sum would be zero.
    we need to do ABS(ARCH_AMT) before doing sum so that SUM will be thousand and data will be picked up.
    please suggest how can we have ABS and sum at a time
    i tried
    <?if: sum(ABS(ARCH_AMT))!='0' ?> and also choose conditions and It's not working.
    thanks in advance.
    Kind Regards,
    Mahi
    Edited by: mahi4luck on Mar 28, 2012 2:33 AM

    store ABS(ARCH_AMT) in a variable, and use that variable in a running total
    example:
    suppose i have an xml structure like this:
    <CATALOG>
    <AMOUNT>
    <ARCH_AMT>-500</ARCH_AMT>
    </AMOUNT>
    <AMOUNT>
    <ARCH_AMT>500</ARCH_AMT>
    </AMOUNT>
    </CATALOG>
    <?xdoxslt:set_variable($_XDOCTX,'vTotal',0)?>
    <?xdoxslt:set_variable($_XDOCTX,'vAbsAmt',0)?>
    <?for-each:AMOUNT?>
    <?xdoxslt:set_variable($_XDOCTX,'vAbsAmt',xdoxslt:abs(ARCH_AMT))?>
    <?xdoxslt:set_variable($_XDOCTX,'vTotal', xdoxslt:get_variable($_XDOCTX, 'vAbsAmt') + xdoxslt:get_variable($_XDOCTX,'vTotal'))?>
    <?end for-each?>
    Total: <?xdoxslt:get_variable($_XDOCTX, 'vTotal')?>

  • Proper Use of the Healing Brush & Patch Tool

    When using the Patch tool and Healing Brush tool to smooth skin, I cannot seem to avoid "grabbing" dark coloring from the clothing as I get close to the edge of the skin.  I have the sample source anchored in the middle of an area far away from the clothing edge, but if I get close to the clothing it pulls from that color and "bleeds" into my healing area.
    I've tried to view tutorials on the Healing Brush, but haven't found anything that addresses this specific condition, just standard "how to" stuff.
    Thank you for any advise and direction here.

    I'll give you a little trick as you can see the preview of the are you are patching it is possible to do a patch clone sort to speak.
    it works like this.
    http://mysite.verizon.net/wzphoto/patch.mov
    if the angle of the clothes do not match you can copy a section and paste and then rotate the section to match and use it as the source for
    the patch tool.
    BTW the idea is that you have to include the contrasting areas so the do not cause a blending. even if the darker area needs no repair.

Maybe you are looking for

  • Apply ACR autowhitebalance as an action to multiple images?

    Is it possible to select a folder of TIFFS, have them be opened in Camera Raw, and use some sort of preset such as auto white balance and a few other tweaks and have them save over the group with those adjustments? I suppose this is similar to asking

  • Question on Pivot table

    I have a requirement as below, at the line I have to add a case statement to see if sum of [0]...[4] is zero then I've to display a value as NO else YES, this just a prototype, the actual query gives more records  USE AdventureWorks2008R2 ; GO SELECT

  • Where can I download pre 7.5 versions of iTunes?

    7.5 is a complete disaster for me (and many others obviously) and I would like to roll back to 7.0 or whichever was before 7.5. Where can I find that and is there a way to keep it from upgrading?

  • Installation trouble with MacOS 1.5

    Hi folks, I am trying to install a trial of Adobe Dreamweaver CS4 on MacOS 1.5. When I launch the installer, the icon appears on the taskbar and disappears some seconds after I entered my password with no obvious reason. However, there is a log which

  • Want to change Photoshop cc bought in Dutch, to English. How can I do this?

    I bought my photoshop cc in dutch, but i want to change him in english. How can I do this?