Subtract calculation

I have a function that calculates the remaining amount from
an entered value and the total value in the database:
<?php
function updateTotal()
$totalled = ($row_total_cost['Total_Bal'] -
$_REQUEST['paid']);
return $totalled;
updateTotal();
?>
<form id="form2" name="form2" method="post"
action="<?php echo updateTotal(); ?>">
<table width="500" border="0" align="center"
cellpadding="3" cellspacing="3">
<tr>
<td width="30" valign="top">Paid:</td>
<td width="152" valign="top"><input type="text"
name="paid" id="paid" /></td>
<td width="136" valign="top">New Balance:</td>
<td width="143" valign="top"><?php echo
updateTotal();?></td>
</tr>
<tr>
<td valign="top"></td>
<td valign="top"> </td>
<td valign="top"><input type="submit" name="update"
id="update" value="Update" /></td>
<td valign="top"> </td>
</tr>
</table>
</form>
What am I doing wrong?

The_FedEx_Guy wrote:
> I'm just trying to subtract one number from another.
>
> The one I want to subtract is the one the User enters in
the textbox.
>
> I have tried to play around with it. And have followed a
Javascript example I
> found online but the value disappers once I press the
submit button.
>
> It will show it for a fraction of a second and then
blank.
>
> <SCRIPT LANGUAGE="JavaScript">
>
> function CalculateSum(Atext, Btext, form)
> {
> var A = parseFloat(Atext);
> var B = parseFloat(Btext);
> form.Answer.value = B - A;
> }
>
> </SCRIPT>
When you press the submit button you will be directed to
calc.php, thus
you need to add a button to your page:
<input type="button" name="calc"
value="Update"
onClick="CalculateSum(this.form.paid.value,
this.form.balance.value, this.form)"/>
Mick.
>
> <form id="form2" name="form2" method="post"
action="calc.php">
> <table width="500" border="0" align="center"
cellpadding="3"
> cellspacing="3">
> <tr>
> <td width="30" valign="top">Paid:</td>
> <td width="152" valign="top"><input type="text"
name="paid"
> id="paid" /></td>
> <td width="136" valign="top">New
Balance:</td>
> <td width="143" valign="top"><INPUT TYPE=TEXT
NAME="Answer"></td>
> </tr>
> <tr>
> <td valign="top"></td>
> <td valign="top"> </td><input
name="balance" type="hidden"
> value="<?php echo $row_total_cost['Total_Bal'];
?>" />
> <td valign="top"><input type="submit"
name="update" id="update"
> value="Update"
onClick="CalculateSum(this.form.paid.value,
> this.form.balance.value, this.form)"/></td>
> <td valign="top"> </td>
> </tr>
> </table>
> </form>
>
>
>

Similar Messages

  • Subtract calculation in an expanding table?

    Hi
    I am currently designing a form in Livecycle ES2 and am in need of calculation script.
    I have an expanding table with add rows on it.
    In the table i have a drop down list with 2 items that be can selected DR and CR, an Amount field and a total field.
    Currently the Amount field and a totals field adds up correctly with this script Sum(Spersonaldetails2.Table1.Item[*].Amount)
    However i now need the Totals field to calculate based on which item from the drop down is selected.
    So if DR is selected i need it to add to the total and if CR is selected i need to subtract from the total.
    One row could be a DR and the next row a CR.
    I am unable to have the totals field subtract the Amount if CR is selected.
    look forward to any help.  i have been wrecking my brain over this.

    Hi,
    A sumif equivalent in FormCalc could look like;
    var totalRows = LoanProposal.Table1._Item.count
    var groupTotal = 0
    var list = ref(LoanProposal.Table1.resolveNodes("Item.[ItemName == ""Lodging""]"))
    for i=0 upto list.length - 1 step 1 do
        groupTotal = groupTotal + list.item(i).Total
    endfor
    Note the totalRows variable is not used but is required so the calculate event knows to fire when a row is added or removed.
    This would have to be repeated for each category so you might want to have a calculate event code at a higher level (like the LoanProposal subform) with some JavaScript code like;
    // Reset all fields
    xfa.host.resetData([Mileage.somExpression, Lodging.somExpression].join(","));
    var rows = Table1.resolveNodes("Item[*]");
    for (var i = 0; i < Table1._Item.count ; i++)
        var row = rows.item(i);
        switch (row.ItemName.rawValue)
            case "Mileage":
          Mileage.rawValue += row.Total.rawValue;
                break;
            case "Lodging":
          Lodging.rawValue += row.Total.rawValue;
                break;
    I've only done the first two categories but you can see the pattern
    Regards
    Bruce

  • Simple subtraction calculation

    Since Acrobat apparently does not have a simple way of subtracting one value from the another, does anyone have a quick, complete Java script for handling this?  I'm trying to take the value of a particular text field and subtract it from another text field and display the calcuation results in yet another third text field.  Is there an easy way to do this?
    Thanks for any assistance.

    Thank you.  Worked perfectly!!!
    Bill Schmidt
    Sales Administrator
    EH Wolf & Sons/Tilot Oil LLC
    262.644.5030  FAX 262.644.5424
    www.ehwolf.com
    This e-mail and any attachments may contain privileged or confidential
    information. This e-mail is intended solely for the use of the individual or
    entity to which it is addressed. If you are not the intended recipient of
    this e-mail, you are hereby notified that any archiving, copying,
    distribution, dissemination or action taken in relation to the contents of
    this e-mail and any of its attachments is strictly prohibited and may be
    unlawful. If you have received this e-mail in error, please notify the
    sender immediately and permanently delete the original e-mail and destroy
    any copies or printouts of this e-mail as well as any attachments.

  • Combo drop box calculation?

    I'm dont work with acrobat much so please excuse my lack of knoweldge. I have been reading all week and have learned a lot about performing calculations. I have no issues with creating simple add and subtract etc. I have been using mostly text feilds but thought this might be easier using a dropdown combo box. What I'm trying to do is have a a calculation for whichever choice is picked in the drop down. But I can't get it right. I own a window cleaning company and charge more money for multiple level homes. So I have set my drop box to list the choices of 2,3,4,5. I charge $50 per addtional level. So if I picked 2 the amount should equal $50.00. The price rises by $50 per level so if I pick 3 the price should be $100, 4 =$150 etc. But I can't figure out how to make the choices a set price. Right now all I can do is multiply or subtract, devide etc. Which is not working because if I choose 2, then the price =$100. If I choose 3 it =$150, 4=$200 etc. I have tried adding a subtraction calculation at the end of the script of -50 but that does not work as it automaticlly places -$50 in the results field which I don't want because I don't want the customer to think they are receiving a discount with that part of the service. I don't care if I have to manually place the numbers in the field. So if I should be doing this as a text field that would be ok also. I just can't figure out how to get this one working.

    Last night I realised there's a small bug in the script I gave you. If you change the value of the combo from something else to zero, the price field will remain the same instead of changing back to zero (which is what I assume should happen). This will fix that:
    if (event.value!="0") {
        this.getField("price").value = (event.value-1)*50;
    } else this.getField("price").value = 0;

  • SIMPLE FORMULA IN ADOBE ACROBAT PRO

    I am not a programmer and do not know how to use Javascript.
    I have a simple calculation that I cannot determine how to put it together.
    Cell A minus Cell B = Cell C
    Each Cell is a total of several cells and I need to determine the net amount with a subtraction calculation.
    Help
    adobewanabe

    If those are really your field names go to the Calculate tab of field C and enter the following as the "Simplified field notation" code:
    A - B
    You'll need to make sure in the Field Calculation Order (which is NOT the same as the tab order) that C is calculated after A and B.

  • Switch statement help please

    I have been advised on this forum that a switch statement in place of the if else etc would be neater. Could someone tell me where the switch statement goes in the code below.
    Thanks
    Calculator class Calculator.java
    class Calculator {
    public void Calculator() {
    public double workOut(String s1) {
    int count = 0, i_s1_len = 0, i_dot=0, i_neg =0;
    double d_calc=0,d_num = 0, d_snum=0 ;
    String s2 = "", s3 = "", s_num="";
    if (s1.length()==0){ //Check for an input eg contains at least one character
    System.out.println("Sorry you must input a equation ending in an equals '=' sign");
    return 0;
    else {
    i_s1_len = s1.length();
    count = 0; //reset count to zero
    //remove spaces s2 becomes the equation
    for (count=0; count+1 <= i_s1_len;){
    if (s1.charAt(count)==32){
    count++;
    else{
    s2=s2+s1.charAt(count);
    count++;
    i_s1_len = s2.length();//
    // check final character is an "=" sign
    if (s2.endsWith("=")){
    else{
    System .out.println( "Sorry your equation must end with an = sign ");
    return 0;
    // Checking if characters in the equation are legal eg 1-9 or ()-+/*. or the = sign is only at the end.
    count = 0; //reset
    for (count=0; count+1 <= i_s1_len;){
    if ((s2.charAt(count)>39)&(s2.charAt(count)<58)){
    count++;
    else if ((s2.charAt(count)==61) & (count != i_s1_len-1)) {
    System.out.println("Operator'=' is in two places ");
    return 0;
    else{
    count++;
    // Selecting Calculation type +-*/ and calculation Type and conversion
    for (count=0; count+1 <= i_s1_len;){
    //Addition calculation 43 = +
    if (s2.charAt(count)== 43){
    s3="+";
    // Subtraction Calculation 45 = -
    else if (s2.charAt(count)== 45){
    s3="-";
    // check for minus minus
    if (s2.charAt(count+1)== 45){
    s3="+";
    // multiplication Calculation 42 = *
    else if (s2.charAt(count)== 42){
    s3="*";
    // Division Calculation 47 =/
    else if (s2.charAt(count)== 47){
    s3="/";
    //Get String for conversion to number
    else s_num=s_num+s2.charAt(count);{
    count++;
    // Transfer number to single varable
    while ((s2.charAt(count)>47)&(s2.charAt(count)<58)||(s2.charAt(count)==46)){
    s_num=s_num+s2.charAt(count);
    count++;
    //check for multiple decimal points
    if (s2.charAt(count-1)==46){
    i_dot++;
    if (i_dot > 1){
    System.out.println("One of your numbers contains two decimals points ");
    return 0;
    i_dot=0; //reset decimal counter
    // Get opperator + - * /
    if (s3 =="+"){
    d_num = d_num + Double.parseDouble(s_num);
    else if (s3 =="-"){
    d_num = d_num - Double.parseDouble(s_num);
    else if (s3 =="*"){
    d_num = d_num * Double.parseDouble(s_num);
    else if (s3 =="/"){
    if (Double.parseDouble(s_num)==0){
    System.out.println("You are trying to divide by Zero which is infinity");
    return 0;
    d_num = d_num / Double.parseDouble(s_num);
    else{
    d_num = Double.parseDouble(s_num);
    s_num="";
    if (s2.length()==count+1) {
    return d_num;
    return d_num;

    Instead of writing
    if (x == 1)
        // do this
    else if (x == 2)
        // do that
    else
        // do the otheryou can write
    switch (x) {
    case 1:
        // do this
        break;
    case 2:
        // do that
        break;
    default:
        // do the other
        break;
    }

  • Positive Value only Display or Edit Pattern

    Hello, could someone please explain how I can prevent a negative result in a calculation field? i.e., a result less than zero. In other words, how can I ensure that users only enter positive values in a numeric field, and that the subsequent simple "subtract" calculation will also remain positive?
    Harry

    THANKS NASSIA, this works for disallowing negatives by force, however it gives me script failed alert.
    Would you know how to suppress "Script Failed" alerts, such as this:
    Script failed (language is formcalc; context is
    xfa[0].form[0].form1[0].SF_CalculationTable[0].acview[1])
    script=(ac[1] / tr[1]) * 100
    Error: arithmetic over/underflow.
    . (+ 25 more...)
    These seem to be only happening because the field is not yet populated, (except with zeros). How do I suppress this error, because the form works fine.

  • 2 buttonhandlers in 1 class?

    Hi all,
    Just started at school with Java.
    So i'm learning ass much as a can, anyway i'm bizzy with making a calculator and when i press a button i learned @ school that you make a class:
    class button1 implements ActionListener {
    public void actionPerformed(ActionEvent e){
    action //etc...
    Oke this works fine with 1 button.
    But when I use multiple buttons they say at school for each button you've got to make a new class, so:
    class button1 implements ActionListener {
    public void actionPerformed(ActionEvent e){
    action //etc...
    class button2 implements ActionListener {
    public void actionPerformed(ActionEvent e){
    action //etc...
    etc...
    My question is: isn't it possible to put all the actions in 1 class?
    Like:
    class button1 implements ActionListener {
    public void button1(ActionEvent e){ //or sometthing
    action //etc...
    public void button2, etc, etc...
    So that i dont need to make 50 classes?
    Thanx in advance!
    Johan

    I have a similiar problem, except with my program i have two JButton's that have ActionListeners and two JTextFields that have ActionListeners. The information put into the two JTextFields has to be used when the either of the JButtons is pressed. My problem is I cannot get java to store the information inputed into the JTextFields so that the JButtons can use it once they are pressed. It really just an Addition/Subtraction calculator. here is the code i have so far that is not working. Im stumped on how to get the input from the two JTextFields to be stored so when the JButtons are pressed it uses that input to calculate the result. Please if you can offer any help it is greatly appreaciated.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.applet.*;
    public class IntegerCalculatorPanel extends JPanel{
    private JButton getsum, subtract;
    private JLabel operand1label, operand2label, operation, Result;
    private JTextField operand1, operand2;
    IntegerCalculator myCalculator = new IntegerCalculator(0,0);
    int value1, value2, result;
    public IntegerCalculatorPanel() {
    getsum = new JButton ("+");
    subtract = new JButton ("-");
    getsum.addActionListener (new ActionListen());
    subtract.addActionListener(new ActionListen());
    Result = new JLabel("Result");
    operation = new JLabel ("Enter second operand:");
    operand1label = new JLabel ("Enter first operand:");
    operand2label = new JLabel ("Enter second operand:");
    operand1 = new JTextField (10);
    operand2 = new JTextField (10);
    operand1label.setText("Enter first operand:");
    operand1.addActionListener(new ActionListen());
    operand2label.setText("Enter second operand:");
    operand2.addActionListener(new ActionListen());
    operation.setText("Select operation");
    Result.setText("Result:" + result);
    add(operand1label);
    add(operand1);
    add(operand2label);
    add(operand2);
    add(operation);
    add(getsum);
    add(subtract);
    add(Result);
    setPreferredSize (new Dimension(275, 100));
    setBackground (Color.yellow);
    setLayout (new FlowLayout());
    private class ActionListen implements ActionListener{
    public void actionPerformed(ActionEvent event)
    if (event.getSource() == getsum);
    Result.setText("Result:" + myCalculator.getsum());
    }

  • Am I " Getting " OO Programming(Code included)

    Hey guys, been fooling around with Java for about 3 weeks now, utilizing a book called How to Program Java 7th Edition and just wanted to come on here and see if you guys would not mind looking through a program I recently wrote(nothing big or spectacular, just an OO test for myself ) and give it a grade. I'm not in a class or anything so I have no " teacher " to assign values to my work. So, hey have at it if you don't mind.
    import java.util.Scanner;
    // this program will use methods to get user values and use those values in calculations
    class SimpleMethods{
         Scanner myScanner = new Scanner(System.in);
         private int userinput, userinput2;
         private int total;
         private int userchoice;
         // this method gets values and stores them for calling
         public void useScanner(){
              System.out.print(" \n\nEnter a number: ");
              userinput = myScanner.nextInt();
              System.out.print(" Enter a number: ");
              userinput2 = myScanner.nextInt();
         // this method will give user options to perform on the integers
         // as well as display the integers entered
         public void displayOptions(){
              System.out.printf(" Your integers are %d and %d, choose option \n\n", userinput, userinput2);
              System.out.println(" 1.) Add Integers ");
              System.out.println(" 2.) Multiply Integers ");
              System.out.println(" 3.) Subtract Integers ");
              System.out.println(" 4.) Divide Integers ");
              System.out.println(" 5.) Exit Program \n");
              System.out.print(" Choose Option: ");
              userchoice = myScanner.nextInt();
         // this method returns the value of userchoice
         public int getChoice(){
                   return userchoice;
         // this method will perform a calculation with the inputed values
         public int getCalculation(){
              total = userinput + userinput2;
              System.out.printf(" %d + %d = %d \n", userinput, userinput2, total);
                   return total;
         // this method performs the multiplication calculation and returns result and output
         public int getMultiply(){
              total = userinput * userinput2;
              System.out.printf(" %d * %d = %d \n", userinput, userinput2, total);
                   return total;
         // this method performs the subtraction calculation and changes the order depending on the higher
         // amount, returning the result and string output
         public int getSubtract(){
              if (userinput2 > userinput){
                   total = userinput2 - userinput;
                   System.out.printf(" %d - %d = %d \n", userinput2, userinput, total);
                   else{
                     total = userinput - userinput2;
                     System.out.printf(" %d - %d = %d \n", userinput, userinput2, total);
                   return total;
         public int getDivide(){
              if (userinput > userinput2){
                   total = userinput / userinput2;
                   int remainder = userinput % userinput2;
                   System.out.printf(" %d / %d = %d \n", userinput, userinput2, total);
                   System.out.printf("\nremainder is %d \n",remainder );
                   else{
                        total = userinput2 / userinput;
                        int remainder = userinput2 % userinput;
                        System.out.printf(" %d / %d = %d \n", userinput2, userinput, total);
                        System.out.printf("\nremainder is %d\n ",remainder);
                   return total;
         // this method will perform further calculations on the results of the other calculations
         public int getFurtherResults(){
              int result = total * 400;
              System.out.printf(" %d multiplied by 400 = %d", total, result);
              return result;
    }Program is basically just a little calculator doing easy operations on 2 variables. Like I said, nothing spectacular. My main goal with the program was to put everything in the file into methods and have the executing program simply use the class objects and methods for the program execution. Here is the executing file.
    import java.util.Scanner;
    public class SimpleTest{
         public static void main(String args[]){
              Scanner myScanner = new Scanner(System.in);
              SimpleMethods mySimpleMethods = new SimpleMethods();
              mySimpleMethods.useScanner();
              mySimpleMethods.displayOptions();
              if (mySimpleMethods.getChoice() == 1){
                   System.out.printf(" \nCalculation result is %d \n", mySimpleMethods.getCalculation());
              if (mySimpleMethods.getChoice() == 2){
                   System.out.printf(" \nCalculation result is %d \n", mySimpleMethods.getMultiply());
              if (mySimpleMethods.getChoice() == 3){
                   System.out.printf(" \nCalculation result is %d \n", mySimpleMethods.getSubtract());
              if (mySimpleMethods.getChoice() == 4){
                   System.out.printf(" \nCalculation result is %d \n", mySimpleMethods.getDivide());
              if (mySimpleMethods.getChoice() == 5){
                   System.out.println( " \nExiting program ");
              mySimpleMethods.getFurtherResults();
    }So based on this simple program, do you think I am " getting " OO programming so far? I've just finished the sections on the selection statements and repetition statements ( while loops, for loops, etc. ) and will be adding to this program with each new piece of info I get. For example I will soon add arrays and will pass array variables with the methods to make it possible to add any number of values into the program. Anyway, thanks guys.

    Well, I mainly meant my usage of method calls and using the object of the SimpleMethods class. Not much in the overall work of the program itself just in the method of how I wrote and executed the program. I could of wrote this program completely in one class with a main method but instead, since I think this is what Java and OO programming is all about, I used methods and objects to perform all the work of the program.
    As for the myScanner in the main class, I usually just include Scanners in all my programs right now just in case I end up using one eventually. Also, the FurtherCalculations() method is just playing around with the end result of other method results, to see if I was doing it all right without error.
    I dont think I've been taught from this booklet how to display error messages, for example if A was used instead of an integer, and keep the program running. I assume that a While statement would be needed like
    while (userChoice == .nextInt() ){
           // run code
                   if (userChoice == .nextLine() || .nextChar() )
                          out.printf (" Error: Must inter an integer " );
          }Something like that I think would work? Except I have no idea if just using random .nextLines or nextChar calls will actually work properly. Its something I have yet to be taught out of this book but from what my brain tells me something like that would be needed to fix the error problem.
    Actually, do Breaks work with anything besides Switches? If so that while loop error message could use a Break to exit the while loop if the error message is showcased. But then it would force a program stop. Hmmmmm, ill figue it out sometime lol.
    Edited by: udontneed2know26 on Apr 29, 2010 2:12 PM
    Edited by: udontneed2know26 on Apr 29, 2010 2:14 PM

  • How to subtract in a calculation in Acrobat Pro 9

    I'm building a pdf with some calculations. I can do a 'sum, product,average,minimum,maximum'. But how do i subtract 2 fields?

    best solution evar. worked fine for me. thanks
    movie
    phim online media... music
    nhac online the world of
    wholesale fashion and models
    wholesale clothing and lovely
    phim han quoc film..?!!

  • Simple calculations of two columns (addition, subtraction, ...)

    Hi,
    I'm a job starter and working with Oralce Discoverer 10gR2 for the first time. I want to create a simple report. So I imported a view that looks like this:
    create or replace view v_report_inventories_bc_group as
    select a.the_date,
    a.entity,
    sum(a.histor_statutory_value) as histor_statutory_value
    from t_r2_facts a
    group by a.entity, a.the_date
    now I've generated a cross tab that looks like this:
    31.12.07 31.01.08 29.02.08 31.03.08
    group 100 200 300 400
    company1 70 150 200 300
    company2 30 50 100 100
    The problem is to show the simple difference between the last to months. Furthermore there are other calculations...
    How should I achieve this?
    Any advice would be very appreciate!
    Regards,
    Steffen

    Hi,
    If I'm understanding your question correctly...
    When you brought this view into the Admin Edition it should have asked you if you wanted to use the Default Date Hierarchy. Assuming you did there should be a value called the_date Month under the items in this folder within Desktop/Plus. You would want to add that item in to the top portion of your crosstab and it will then break out the data by month.
    To Subtract Column A from Column B you would create a calculation. The below link has a section called "How to create calculations" which should be of assistance.
    Thanks,
    Jeff
    http://download.oracle.com/docs/html/B13915_04/calculations.htm#i1012748
    Message was edited by:
    Jeff Hohman

  • Subtract business days from date - calculated column

    Hello,
    I had a calculated column on a library that took two dates and found the difference between them in business days, but I am not sure how to subtract business days from a date...for instance I get a start date from a form and I need to
    subtract 10 business days from that date.
    Can anyone help?

    I've always resorted to Javascript/JQuery for that kind of function. I found an old fashioned loop worked the best for me - it supports going forward or backwards. I key it off of a change in a starting date, or sometimes a status change. My actual production
    code takes into account another list where we remove holidays and non-work days.
    newDate = getNextDate(newDate, -3);
    $("input[title='Date Due']").val((newDate.getMonth() + 1) + "/" + newDate.getDate() + "/" + newDate.getFullYear());
    function getNextDate(currentDate, offset) {
    // offset is business days
    var wkend = 0;
    var index = Math.abs(offset); // need positive number for looping
    var neg = true;
    if(offset >= 0) { neg = false; }
    var curDOW = currentDate.getDay();
    var nextDate = new Date(currentDate);
    for(var i=1; i <= index; i++) {
    nextDate.setDate(nextDate.getDate() + (neg ? -1: 1));
    var nextDOW = nextDate.getDay();
    if(nextDOW == 0) {nextDate.setDate(nextDate.getDate() + (neg ? -2: 1));} // Sunday
    if(nextDOW == 6) {nextDate.setDate(nextDate.getDate() + (neg ? -1: 2)); } // Sat
    // alert("offset is " + offset + "start: " + currentDate + ", next date is " + nextDate);
    return nextDate;
    Robin

  • Can you open a calculator and add or subtract within a cell?

    I am trying to see if there is a way to use the number pad as a calculator and add figures then enter into a cell for further use.  I want to eliminate the use of my adding machine if possible and just use my keyboard to do my additions and enter directly into my spreadsheet.  Is there a function that opens a calcultor for a cell, do the additions on the keypad, hit enter and have the total put into the cell?

    AG,
    Are you aware that OSX has, built-in, Calculator.app?
    With Calculator.app, you can make your calculations, Command-C to copy the result to the Clipboard, switch to Numbers and Command-V into the target cell.
    Jerry

  • PLEASE HELP - Subtraction not calculating correctly

    Post Author: hollyschulz
    CA Forum: Formula
    This formula I have seems to work any other time, but this one batch I am reporting on doesn't work properly:
    (distinctcount({CHART.CHART_ID}))-(distinctcount({@nc})){@nc} = if ({CHART.SUSPEND_CODE} <> "GC") then 1
    The results for {@nc} is 0 in the report, the result for (distinctcount({CHART.CHART_ID})) is 41.  How come this result of  (distinctcount({CHART.CHART_ID}))-(distinctcount({@nc})) is 40 in the report?? (41-0 should = 41 but crystal has 41-0 = 40)
    I tried adding a +1 to the end of the formula and pulling data from a different batch, but the results were 1 too much.

    Post Author: V361
    CA Forum: Formula
    Hi, Sometimes I will break the formula on purpose, save it any way and run, then when the error pops up, it will show the values in the formula editor. (in CR XI anyway)  try this formula..
    (distinctcount({CHART.CHART_ID}))-(distinctcount({@nc})){@nc} = if ({CHART.SUSPEND_CODE} <> "GC") then 1 / 0
    This will cause the formula to fail, but hopefully you will be able to see the value of {@nc} during the calculation.  Also, try adding this to the details section and manually count.
    If that does not help, could you give some sample data.

  • Dynamic calculations in a materialized view

    Hi,
    I have a problem. I created a materialized view which works perfectly. But now I need to perform some calculations with the data in my view . The view contains the working hours of employees who worked in different projects. Every project has a fixed amount of time (time_available) in which the employee has to finish the project. I aggregated the working hours to month for better presentation. What I want to accomplish here is a "simple" subtraction of "fixed amount for a project" minus "working hours" for the employee.
    The problem here is that some project have duration of more that just one month. Naturally all my values are in one tuple for every month. So when I have 3 month of working hours for a project my view looks like this:
    MV_Working_Hours:
    Project --- Time_Available --- DATE --- Employee --- Working Days
    Project A --- 50 Days --- 2011-05 --- Mr. A --- 15 Days
    Project A --- 50 Days --- 2011-06 --- Mr. A --- 16 Days
    Project A --- 50 Days --- 2011-07 --- Mr. A --- 16 Days
    What I want to do is to calculate the remaining days like this :
    Project --- Time_Available --- DATE --- Employee --- Working d in Month ---reaming days
    Project A --- 50 Days --- 2011-05 --- Mr. A --- 15 Days --- 35 Days
    Project A --- 50 Days --- 2011-06 --- Mr. A --- 16 Days --- 19 Days <--- I get here 34 which is for my need wrong !!!
    Project A --- 50 Days --- 2011-07 --- Mr. A --- 16 Days --- 3 Days
    Is there a way to realize this with "just" sql or do I have to use pl/sql in the OWB? I use the OWB version 11gR2
    thx

    For everybody who is confronted with the same problem I have - here is the solution: (thx to "spencer7593" and "Justin Cave" from StackOverflow)
    SUM( "Working Days" )
    OVER (PARTITION BY "Product", "Employee"
    ORDER BY "DATE"
    ROWS UNBOUNDED PRECEDING)
    and please check out the link from oracle for _"SQL for Analysis and Reporting"_: http://download.oracle.com/docs/cd/E14072_01/server.112/e10810/analysis.htm

Maybe you are looking for

  • Questions on SSO and OID implementation on oracle EBIZ R12.0.6 ID 376811.1

    Hello Guys, IS ORACLE 10g enterprise edition is same oracle identity management because I am bit confused what is going on when we logged an SR we have been told to use oracle 10g AS (10.1.3.5) but in the note its always says oracle 10g AS 10.1.4.X.

  • Can't send Mail with AOL address-out of ideas

    hello, I can recieve mail just fine. It's only when I try to send it. I've tried changing the outgoing server to smtp.aol.com and 4.78.166.10. changed the ports from 25 to 587 to 1024. I appreciate your help. thanks in advance. -Seth powermac g4   Ma

  • Read the first line of the table.

    Hi, Can you pls let me know as to how I read the first line of the table. Thx.

  • Safari can't open a link but others can

    Here is the link: https://www.facebook.com/bestbuy/app_187400188063684#_=_ What's the problem for safari? Why apple can't improve it's software? Safari has following shorpoints, 1. Can't set to open a 'full site' by default, mobile site usually has l

  • IWeb and iPhone icons

    I have created a iphone friendly website with iWeb, and want to make an icon so i can use the add bookmark to home screen feature to my iphone. How would i do this with iWeb? Or is it not available? Thank You