Help with Match Calculations

I have a simple form on a web page for associaiton members to
order lapel pins. I want to provide a toal cost of the order but I
can't for the life of me get anything to multiply the value in a
text fiels by a constant number ($5.00). I found some Javascript on
the internet but I couldn't get it to function either. I am using
Dreamweaver 8 and cannot find any reference to simple math
calculations. Imust be overlooking something as something so simple
can't be that hard. Can someone provide me with some simple script
or method of doing this?

>I have a simple form on a web page for associaiton
members to order lapel
>pins.
> I want to provide a toal cost of the order but I can't
for the life of me
> get
> anything to multiply the value in a text fiels by a
constant number
> ($5.00).
In ASP/VBSCRIPT:
<%
Dim varAmount
varAmount = Request.Form("HowMany") * 5
Response.Write FormatCurrency("varAmount")
%>

Similar Messages

  • Help with Custom calculation script in Acrobat 8

    Hi all, I am using acrobat 8 on OS 10.5
    I am trying to add certain fields (numbers) and then subtract another field value to give an end result.
    I don't know anything about Javascript, would anyone be able to help with any info on how I achieve this result? I can only see Add, x and average etc... nothing there for subtraction
    Thanks for any help in advance
    Swen

    This should get you started:
    >if (event) {
    // get values from two text fields
    var a = Number(this.getField('Text1').value);
    var b = Number(this.getField('Text2').value);
    // subtract the values and show it
    this.event.target.value = a - b;
    Place this in a 3d text field, as a Custom Calculation Script.

  • Help with query calculations (recursive)

    Hi All,
    I want some help with a query using a base rate and the result use in the next calculation year.
    Here an example:
    create table rate_type(
    rate_type_id    number,
    rate_desc       nvarchar2(50),
    rate_base_year  number
    insert into rate_type(rate_type_id, rate_desc, rate_base_year) values (1, 'Desc1', 4.6590);
    insert into rate_type(rate_type_id, rate_desc, rate_base_year) values (2, 'Desc2', 4.6590);
    create table rates (
    rate_type_id number
    rate_year    number,
    rate_value   number
    insert into rates(rate_type_id, rate_year, rate_value) values (1, 2012, 1.2);
    insert into rates(rate_type_id, rate_year, rate_value) values (1, 2013, 1.3);
    insert into rates(rate_type_id, rate_year, rate_value) values (1, 2014, 1.4);
    insert into rates(rate_type_id, rate_year, rate_value) values (2, 2012, 1.2);
    insert into rates(rate_type_id, rate_year, rate_value) values (2, 2013, 1.3);
    insert into rates(rate_type_id, rate_year, rate_value) values (2, 2014, 1.4);The calculation for the first year should be the base rate of the rate type. The next year should use the result of the previous year and so on.
    The result of my sample data is:
    2012 = 4.659 + 1.2 + 4.659 * (1.2 * 0.01) = 5.9149
    2013 = 5.9149 + 1.3 + 5.9149 * (1.3 * 0.01) = 7.1859
    2014 = 7.1859 + 1.4 + 7.1859 * (1.4 * 0.01) = 8.4721Query result:
    NAME 2012 2013 2014
    Desc1 5.9149 7.1859 8.4721
    Desc2 XXXX XXX XXXX
    How can I do this in one select statement? Any ideas?
    Thanks!

    Assuming you are on 11.2:
    with t as (
               select  a.rate_type_id,
                       rate_desc,
                       rate_year,
                       rate_base_year,
                       rate_value,
                       count(*) over(partition by a.rate_type_id) cnt,
                       row_number() over(partition by a.rate_type_id order by rate_year) rn
                 from  rate_type a,
                       rates b
                 where a.rate_type_id = b.rate_type_id
        r(
          rate_type_id,
          rate_desc,
          rate_year,
          rate_base_year,
          rate_value,
          cnt,
          rn,
          result
         ) as (
                select  rate_type_id,
                        rate_desc,
                        rate_year,
                        rate_base_year,
                        rate_value,
                        cnt,
                        rn,
                        rate_base_year + rate_value + rate_base_year * rate_value * 0.01 result
                  from  t
                  where rn = 1
               union all
                select  t.rate_type_id,
                        t.rate_desc,
                        t.rate_year,
                        t.rate_base_year,
                        t.rate_value,
                        t.cnt,
                        t.rn,
                        r.result + t.rate_value + r.result * t.rate_value * 0.01 result
                  from  r,
                        t
                  where t.rate_type_id = r.rate_type_id
                    and t.rn = r.rn + 1
    select  *
      from  (
             select  rate_desc name,
                     rate_year,
                     result
               from  r
               where rn <= cnt
      pivot (sum(result) for rate_year in (2012,2013,2014))
      order by name
    NAME             2012       2013       2014
    Desc1        5.914908  7.2918018 8.79388703
    Desc2        5.914908  7.2918018 8.79388703
    SQL> Obviously pivoting assumes you know rate_year values upfront. If not, then without pivoting:
    with t as (
               select  a.rate_type_id,
                       rate_desc,
                       rate_year,
                       rate_base_year,
                       rate_value,
                       count(*) over(partition by a.rate_type_id) cnt,
                       row_number() over(partition by a.rate_type_id order by rate_year) rn
                 from  rate_type a,
                       rates b
                 where a.rate_type_id = b.rate_type_id
        r(
          rate_type_id,
          rate_desc,
          rate_year,
          rate_base_year,
          rate_value,
          cnt,
          rn,
          result
         ) as (
                select  rate_type_id,
                        rate_desc,
                        rate_year,
                        rate_base_year,
                        rate_value,
                        cnt,
                        rn,
                        rate_base_year + rate_value + rate_base_year * rate_value * 0.01 result
                  from  t
                  where rn = 1
               union all
                select  t.rate_type_id,
                        t.rate_desc,
                        t.rate_year,
                        t.rate_base_year,
                        t.rate_value,
                        t.cnt,
                        t.rn,
                        r.result + t.rate_value + r.result * t.rate_value * 0.01 result
                  from  r,
                        t
                  where t.rate_type_id = r.rate_type_id
                    and t.rn = r.rn + 1
    select  rate_desc name,
            rate_year,
            result
      from  r
      where rn <= cnt
      order by name,
               rate_year
    NAME        RATE_YEAR     RESULT
    Desc1            2012   5.914908
    Desc1            2013  7.2918018
    Desc1            2014 8.79388703
    Desc2            2012   5.914908
    Desc2            2013  7.2918018
    Desc2            2014 8.79388703
    6 rows selected.
    SQL> SY.

  • Help with Javascript/Calculations

    Hello,
    Have a building use policy for school.
    Need help with checkboxes and default values.  I can get javascript/math to work when I click check box.
    Someone wants to rent a room they check the rentRoom checkbox.  Then the enter how many rooms 1,2,3 etc..  The value for the rentRoom checkbox is $25.
    I can get it when the checkbox for rentRoom is selected the rentRoom.Total computes correctly.  However, what I want is when the form opens up a default value of $0.00 to be in there.  I also want if someone goes back and unchecks the rentRoom checkbox the value goes back to $0.00 not just blank.   Right now I am getting the error the value entered does not match the value of the field.  That is if I put the default value in options.  Basically, I can't seem to figure out the javascript code to get this to work.
    Am I asking for too much, can someone guide me to javascript to help me out.
    I have tried if/then statements and switch statements.  I just can't figure out how to get it to for lack of better a word - toggle back and forth.
    If this is not possible please tell me.  If it is too complicated tell me.  I am not using livecycle for this as we had a word document and I just used the find form fields.  I am also using Adobe Acrobat 8 Professional.
    Thanks

    Hello,
    Thanks that looks good.  I am still missing something but the calc doesn't work when I put in my variables.  I will work with it more but nothing happens.
    The one thing is I have the default value of the checkbox as 15 so don't know if that messes it up.
    Right now I get the default value of $0.00 all the time.  When I click on the check box on/off it doesn't do the calcs.
    sorry, any more input, what am i missing??
    I also changed the syntax error that was posted on your origianl post.  You had == 'Off" I changed that to 'Off'

  • URGENT Help With Scientific Calculator!

    Hi everybody,
    I designed a calculator, and I need help with the rest of the actions. I know I need to use the different Math methods, but I tried tried that and it didn't work. Also, it needs to work as an applet and application, and in the applet, the buttons don't appear in order, how can I fix that?
    I will really appreciate your help with this program, I can't get it to work and I'm frustrated, I need to finish this for next Tuesday 16th. Please e-mail me at [email protected].
    Below is the code for the calcualtor.
    Thanks a lot!
    -Maria
    // calculator
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.border.*;
    public class calculator extends JApplet implements
    ActionListener
      private JButton one, two, three, four, five, six, seven,
      eight, nine, zero, dec, eq, plus, minus, mult, div, clear,
      mem, mrc, sin, cos, tan, asin, acos, atan, x2, sqrt, exp, pi, percent;
      private JLabel output, blank;
      private Container container;
      private String operation;
      private double number1, number2, result;
      private boolean clear = false;
      //GUI
      public void init()
        container = getContentPane();
        //Title
        //super("Calculator");
        JPanel container = new JPanel();     
        container.setLayout( new FlowLayout( FlowLayout.CENTER
        output = new JLabel("");     
        output.setBorder(new MatteBorder(2,2,2,2,Color.gray));
        output.setPreferredSize(new Dimension(1,26));     
        getContentPane().setBackground(Color.white);     
        getContentPane().add( "North",output );     
        getContentPane().add( "Center",container );
        //blank
        blank = new JLabel( "                    " );
        container.add( blank );
        //clear
        clear = new JButton( "CE" );
        clear.addActionListener(this);
        container.add( clear );
        //seven
        seven = new JButton( "7" );
        seven.addActionListener(this);
        container.add( seven );
        //eight
        eight = new JButton( "8" );
        eight.addActionListener(this);
        container.add( eight );
        //nine
        nine = new JButton( "9" );
        nine.addActionListener(this);
        container.add( nine );
        //div
        div = new JButton( "/" );
        div.addActionListener(this);
        container.add( div );
        //four
        four = new JButton( "4" );
        four.addActionListener(this);
        container.add( four );
        //five
        five = new JButton( "5" );
        five.addActionListener(this);
        container.add( five );
        //six
        six = new JButton( "6" );
        six.addActionListener(this);
        container.add( six );
        //mult
        mult = new JButton( "*" );
        mult.addActionListener(this);
        container.add( mult );
        //one
        one = new JButton( "1" );
        one.addActionListener(this);
        container.add( one );
        //two
        two = new JButton( "2" );
        two.addActionListener(this);
        container.add( two );
        //three
        three = new JButton( "3" );
        three.addActionListener(this);
        container.add( three );
        //minus
        minus = new JButton( "-" );
        minus.addActionListener(this);
        container.add( minus );
        //zero
        zero = new JButton( "0" );
        zero.addActionListener(this);
        container.add( zero );
        //dec
        dec = new JButton( "." );
        dec.addActionListener(this);
        container.add( dec );
        //plus
        plus = new JButton( "+" );
        plus.addActionListener(this);
        container.add( plus );
        //mem
        mem = new JButton( "MEM" );
        mem.addActionListener(this);
        container.add( mem );   
        //mrc
        mrc = new JButton( "MRC" );
        mrc.addActionListener(this);
        container.add( mrc );
        //sin
        sin = new JButton( "SIN" );
        sin.addActionListener(this);
        container.add( sin );
        //cos
        cos = new JButton( "COS" );
        cos.addActionListener(this);
        container.add( cos );
        //tan
        tan = new JButton( "TAN" );
        tan.addActionListener(this);
        container.add( tan );
        //asin
        asin = new JButton( "ASIN" );
        asin.addActionListener(this);
        container.add( asin );
        //acos
        acos = new JButton( "ACOS" );
        cos.addActionListener(this);
        container.add( cos );
        //atan
        atan = new JButton( "ATAN" );
        atan.addActionListener(this);
        container.add( atan );
        //x2
        x2 = new JButton( "X2" );
        x2.addActionListener(this);
        container.add( x2 );
        //sqrt
        sqrt = new JButton( "SQRT" );
        sqrt.addActionListener(this);
        container.add( sqrt );
        //exp
        exp = new JButton( "EXP" );
        exp.addActionListener(this);
        container.add( exp );
        //pi
        pi = new JButton( "PI" );
        pi.addActionListener(this);
        container.add( pi );
        //percent
        percent = new JButton( "%" );
        percent.addActionListener(this);
        container.add( percent );
        //eq
        eq = new JButton( "=" );
        eq.addActionListener(this);
        container.add( eq );
        //Set size and visible
        setSize( 190, 285 );
        setVisible( true );
    public static void main(String args[]){
        //execute applet as application
         //applet's window
         JFrame applicationWindow = new JFrame("calculator");
    applicationWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         //applet instance
         calculator appletObject = new calculator();
         //init and start methods
         appletObject.init();
         appletObject.start();
      } // end main
      public void actionPerformed(ActionEvent ae)
        JButton but = ( JButton )ae.getSource();     
        //dec action
        if( but.getText() == "." )
          //if dec is pressed, first check to make shure there
    is not already a decimal
          String temp = output.getText();
          if( temp.indexOf( '.' ) == -1 )
            output.setText( output.getText() + but.getText() );
        //clear action
        else if( but.getText() == "CE" )
          output.setText( "" );
          operation = "";
          number1 = 0.0;
          number2 = 0.0;
        //plus action
        else if( but.getText() == "+" )
          operation = "+";
          number1 = Double.parseDouble( output.getText() );
          clear = true;
          //output.setText( "" );
        //minus action
        else if( but.getText() == "-" )
          operation = "-";
          number1 = Double.parseDouble( output.getText() );
          clear = true;
          //output.setText( "" );
        //mult action
        else if( but.getText() == "*" )
          operation = "*";
          number1 = Double.parseDouble( output.getText() );
          clear = true;
          //output.setText( "" );
        //div action
        else if( but.getText() == "/" )
          operation = "/";
          number1 = Double.parseDouble( output.getText() );
          clear = true;
          //output.setText( "" );
        //eq action
        else if( but.getText() == "=" )
          number2 = Double.parseDouble( output.getText() );
          if( operation == "+" )
            result = number1 + number2;
          else if( operation == "-" )
            result = number1 - number2;
          else if( operation == "*" )
            result = number1 * number2;
          else if( operation == "/" )
            result = number1 / number2;       
          //output result
          output.setText( String.valueOf( result ) );
          clear = true;
          operation = "";
        //default action
        else
          if( clear == true )
            output.setText( "" );
            clear = false;
          output.setText( output.getText() + but.getText() );
    }

    Multiple post:
    http://forum.java.sun.com/thread.jsp?forum=31&thread=474370&tstart=0&trange=30

  • Help with Auto calculations

    I have an existing pdf that i am trying to edit and make it more functional...i.e. fillable info with auto calculations of cost based on a given number (times a specific cost)
    Example on the form....
    Car Registrations (per car) _____ X $25 _________
    The first line above is # Cars Registered
    The last line is Total Cost
    The blank lines above i have added a text box to for auto calculations. I have formated these boxes as numbers (first line) and dollar value total (second line)
    I've added another text box for the $25 and placed it overtop the worded one. I've locked this box and the total box. I've calculated the product of the total box by linking it to the first line and the $25 to give the total cost...
    Problem is, it isnt working....the total box isn't seeing the $25 to give a proper calc. Whatever number i place in the first line, only zero shows in the total.
    I'm obviously missing something....been at this for two days....frustrated. I have many more inputs like this on the form, and eventually want all the totals to provide sub totals and a grand total. I understand how this all works to a degree, doesnt seem that difficult, but i have to be missing something.
    I even tried re-creating the document in word, input to adobe, make a new form, let the system recoginize areas as fillable, etc, etc, etc. When i get to the calculations portion, same result...there are not many tutorials out there on this...sadly
    Woking on a MAC...
    I have acrobat X Pro

    gr8snkbite wrote:
    I have an existing pdf that i am trying to edit and make it more functional...i.e. fillable info with auto calculations of cost based on a given number (times a specific cost)
    Example on the form....
    Car Registrations (per car) _____ X $25 _________
    The first line above is # Cars Registered
    The last line is Total Cost
    The blank lines above i have added a text box to for auto calculations. I have formated these boxes as numbers (first line) and dollar value total (second line)
    I've added another text box for the $25 and placed it overtop the worded one. I've locked this box and the total box. I've calculated the product of the total box by linking it to the first line and the $25 to give the total cost...
    Problem is, it isnt working....the total box isn't seeing the $25 to give a proper calc. Whatever number i place in the first line, only zero shows in the total.
    I'm obviously missing something....been at this for two days....frustrated. I have many more inputs like this on the form, and eventually want all the totals to provide sub totals and a grand total. I understand how this all works to a degree, doesnt seem that difficult, but i have to be missing something.
    I even tried re-creating the document in word, input to adobe, make a new form, let the system recoginize areas as fillable, etc, etc, etc. When i get to the calculations portion, same result...there are not many tutorials out there on this...sadly
    Woking on a MAC...
    I have acrobat X Pro
    I created your sample.
    name the field after Number  of cars, as car
    The calulation field named total

  • Need help with a calculated column - is there any way to reference a value in the current row?

    Hey guys,
    I'm a bit of a DAX newbie, and I'm running into a block. I'm creating a Power View report about IT tickets. We are going to be creating a cube to automate the data soon, I'm currently working with a flat Excel Data Table of data to demonstrate the Power
    View reporting capabilities to the team. I need the default display to show the top 4-5 items basked on the Ticket Count. The three applicable columns I'm using are the TicketID, the ContactReason, and the AssetCategory - all three are
    text. One slide will show the top five Contact Reasons by Ticket Count, and the other will show the top five Categories by Ticket Count. The users will see this default view, but will be able to change it to see differently ranked items or can clear the
    ranking slicer altogether.
    What I've accomplished so far is to create the Calculated Field [Ticket Count] = COUNTA(Table1[TicketID])
    And 2 other calculated fields:
    [Contact Rank] = RANKX(ALL(Table1[ContactReason]),[Ticket Count],,,DENSE)
    [Asset Rank] = RANKX(ALL(Table1[AssetCategory]),[Ticket Count],,,DENSE)
    If I were creating a Pivot Table, this would be great. These fields calculate everything the right way. The problem is, I need to have a Rank slicer on each slide and the calculation by itself contains no data - with no data, there's nothing to slice. I
    realized I need to actually have columns of data so I can create a slicer. I need each row of the table to show the same [Contact Rank] for every instance of a particular ContactReason (and the same for the [Asset Rank] and AssetCategory).
    The RANKX formulas pasted into the Calculated Column section only show a value of 1 - with no Pivot table summarizing the fields, it's counting each row's ticket once, giving every line the tied Rank of #1.
    I've solved the problem in Excel by creating 2 Pivot Tables on a separate sheet that have the data field and the calculated field for ContactRason and AssetCategory. Then on my Excel Data Table, I've added two columns that do a VLOOKUP and pull over a the
    Calculated Rank from each Pivot Table that match the ContactReason and AssetCategory fields. This works on the flat Excel Data Table now, but will not be a solutions when we start pulling the data from the cube (and there is no flat table).
    What I think I need is an Expression for the RANKX formula that can give me, for each row, the count of all of the times a ContactReason shows up in an entire column. There's only about 100,000 lines of data and each ContactReason or AssetCategory
    may show up several thousand times. But if I can get the expression to return that count, then the RANKX formula should work in the Column. If it wasn't a DAX formula, I'd use a COUNTIF and say 'Count the entire ContactReason column anytime it's equal to the
    ContactReason on THIS row', but in DAX I don't know how to reference a single value in a row. I've tried the CALCULATE() formula, but it seems like the filter needs a specific value, and doesn't work on a dynamic "cell" value.
    Any help would be greatly appreciated! (I hope it all makes sense!)

    If I've understood you correctly then the ALLEXCEPT function may be what you're after and it could be applied in a similar way to the following...
    =
    RANKX(
    ALL(Table1),
    CALCULATE(
    COUNTROWS(table1),
    ALLEXCEPT(Table1, Table1[ContactReason])
    DENSE
    If this has missed the mark, would it be possible to clarify the requirement further?
    Regards,
    Michael Amadi
    Please use the 'Mark as answer' link to mark a post that answers your question. If you find a reply helpful, please remember to vote it as helpful :)
    Website: http://www.nimblelearn.com
    Blog: http://www.nimblelearn.com/blog
    Twitter: @nimblelearn

  • DAX - Need help with TotalYTD calculation with Rolling 12 Months (Fiscal Months)

    These are the tables I currently have in my solution:
    DimDate - date dimension - our fiscal periods don't match with calendar periods
    Fact Claims - ID, Date, Doc#, Amount,  ProductKey
    DimDateR12 - fiscal periods with max and min calendar dates - using DatesAdd gave me error because of contiguous dates error, so ended up using this.
    Here are the calculations -
    Issue Count = Distinct count of Products where (Sum of amount >= 1000 and count of claims >= 5) in last 12 fiscal periods - I am using summarize function here.
    I need to add another calculation where I need to count issues resolved.
    Issues resolved = Distinct count of products, where Rolling 12 Claims Amount >= 1000 and claim count >= 5 in the previous fiscal period) and Current fiscal period, NOT(Rolling 12 Claims Amount >= 1000 AND claim count >= 5) - this needs
    to be a cumulative calculation.
    I got Issues Resolved Calculation to work with summarize function, but using TotalYTD (using Fiscal Date key) to get cumulative number, is not working. Here is my calculation - TotalYTD([Count of Issues Resolved],DimDateR12[FiscalDate])
    I tried using All(DimDateR12) filter, but didn't work.
    Any help is really appreciated.
    Thanks,
    Sonal

    These are the calculations I am currently using -
    Rolling12ClaimCount:=CALCULATE(FactClaim[ClaimCount],FILTER(DimDate,AND(DimDate[Calendar Date] >= Min(DimDateR12[StartDate]),DimDate[Calendar Date] <= Max(DimDateR12[EndDate]))))
    Rolling12ClaimAmount:=CALCULATE(FactClaim[ClaimAmount],FILTER(DimDate,AND(DimDate[Calendar Date] >= Min(DimDateR12[StartDate]),DimDate[Calendar Date] <= Max(DimDateR12[EndDate]))))
    IsCurrentIssue:=IF(([Rolling12ClaimAmount] >= 1000) && ([Rolling12ClaimCount] >= 5),TRUE(),FALSE())(([Rolling12ClaimAmount] >= 1000) && ([Rolling12ClaimCount] >= 5),TRUE(),FALSE())
    WasWarrantyIssue:=IF(([PrevFiscalPeriodRolling12ClaimAmount] >= 1000) && ([PrevFiscalPeriodRolling12ClaimCount] >= 5),TRUE(),FALSE())
    Resolvedissues:=IF(AND([IsWarrantyIssue]=FALSE(),[WasWarrantyIssue]=TRUE()),1,0)
    Rolling12IssuesResolved:=SUMX(SUMMARIZE(FactClaim,FactClaim[ProductKey],"ResolvedIssueCount",[Resolvedissues]),[ResolvedIssueCount])
    YTDResolvedIssues:=TotalYTD([Rolling12IssuesResolved],DimDateR12[FiscalDate])
    -- Fiscal Date is <Fiscal Period>/1/<Fiscal year>
    Thanks,
    Sonal

  • Help with simple calculation

    I'm slowly learning myself Java through JBuilder 6. I'm currently on with a currency convertor, one of my first programs that does more than say "Hello world". Anyway, this is a section of my code
    void submit_actionPerformed(ActionEvent e) {
    String s = jTextField1.getText();
    try {
    val = Double.parseDouble(s);
    catch (NumberFormatException exp) {
    val = 0;
    if (jComboBox2.getSelectedItem() == "US Dollar") {
    dResult = val * dDollar;
    else if (jComboBox2.getSelectedItem() == "Pound Sterling") {
    dResult = val * dPound;
    else if (jComboBox2.getSelectedItem() == "Euro") {
    dResult = val * dEuro;
    else if (jComboBox2.getSelectedItem() == "Bahrain Dinar") {
    dResult = val * dDinar;
    else if (jComboBox2.getSelectedItem() == "Australian Dollar") {
    dResult = val * dADollar;
    else
    dResult = val *dYen;
    jTextField2.setText("" + dResult);
    void jButton1_actionPerformed(ActionEvent e) {
    jTextField2.setText("" + dResult);
    The idea is for the user to enter their amount, select which currency they want from the combobox, then the result is displayed back to them. However, each time I run this program as it is, the result is always zero. I assume there's something wrong in the calculation, can anyone help me?

    Thanks, how would I do that? I have this code in my program too (I haven't posted the whole thing)
    private void jbInit() throws Exception {
    this.setSize(new Dimension(400,300));
    jButton1.setText("Convert");
    jButton1.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(ActionEvent e) {
    jButton1_actionPerformed(e);
    jTextField2.setText("Result");
    jTextField2.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(ActionEvent e) {
    jTextField2_actionPerformed(e);
    I did try adding another actionListener, but the program would not work when it was inserted. Thanks for any help!

  • Help with date calculation based on office hours

    Hi,
    could you guys point me which way should I think of in PL/SQL, or maybe SQL to calculate a date using not 24 hours day, but office hours.
    Let me give you an example
    Office hours are between 9am till 5pm
    I receive a case - registration time - 14.03.2013 4pm, and I'm supposed to calculate the Due date, let's say Registration time + 10hours.
    Normaly I would do "registration time" + 10hours, but I can't. I cannot use 24 hours window for the calculation, but 9am - 5pm window.
    So the "Due timestamp" would be = "16.3.2013 10am". Which is : 1 hour from 14.03. + 8hours from 15.3. + 1 hour from 16.3.
    Thanks for any ideas.

    Hi,
    A user-defined function would be very handy for that. Foir example
    add_office_hours ( in_start_date DATE
                     , in_num_hours  NUMBER
    RETURN DATE
    DETERMINISTIC ...First, copy in_start_date to a local variable, start_date, and check if start_date is within office hours. If not, change it to the beginning of the next business day.
    Add in_num_hours to start_date. Is the result before 5pm on the same day?
    If so, the function is finished. Return that date.
    If not, find how much past 5pm the result is, and recurse (that is, have the function call itself with a new, later in_start_date and a new, smaller in_num_hours). If you prefer, you can use a loop instead of recursion.
    How do you treat weekend and holidays?
    Would you want to call the function with a negative number of hours?
    If you'd like help. post your best attempt.
    Post CREATE TABLE and INSERT statements for a table that you use for testing. The table should have start_date, num_hours and correct_result_date columns.
    Always say which version of Oracle you're using (e.g. 11.2.0.3.0).
    See the forum FAQ {message:id=9360002}

  • Help with a Calculation Script

    I'm not sure if this is possible or not, but I have two checkboxe options on a form. When an item is checked, I want the total form to update, but I can't get it to work.
    So CalcLine1 is a checkbox with an on value of $825.12
    and CalcLine2 is a checkbox with an on value of $20
    As the boxes are checked, I want the numeric field CalcTotal to update. I have it set with a Value Type of Calculated-Read only, but don't know where to go next.

    Hi,
    I am a new user and need to do some simple calculations, preferably without creating script. I have a series of check boxes which I want to equal "1" when checked. I need them to subtotal and then total.
    I am using LiveCycle 8.0. There is no database behind this form although that would be a possible future enhancement.
    Also - is there a good resource for understanding the basic manipulation of forms - answering questions like - What is a sub form? Can I insert a field in the middle of the form and have everything move down? Everything I have found deals with a more complex level of form creation, yet the help screens don't give enough of the underlying concepts. Thanks!

  • Help with math / calculations in RTF templates

    Greetings,
    I know that there are math capabilities in the templates... I've seen the code samples in the Core Components guide.
    What this doesn't tell you is WHERE these things would go in a template. And... that... is my question.
    We are just starting to use BIP in conjunction with JDE EnterpriseOne (8.12, tool set 8.97.12). For our first attempt we're creating our template over a new report.
    I have a template where I sum two different repeating values (through the normal BI Properties) and place these values in two separate cells in a table. I want to sum the two of these together for a "grand" total.
    I've seen the "examples" but they really aren't very helpful. The xsfo, etc. for doing addition is fine, but WHAT are the values to add and WHERE does the code go?
    If anyone has done something like this or has experience using the embedded code I would appreciate hearing from you.
    Thanks in advance

    I see what you are saying about the spaces... but it made no difference... still got the error.
    The XML file is too large and convoluted to be pasted here.
    With reqards to the following snippet:
    COLA = <?sum(current-group()/COLA)?>
    COLB = <?sum(current-group()/COLB)?>
    Summ== <?sum(current-group()/COLA) + sum(current-group()/COLB)?>
    Where does THIS code go?
    Here is the error detail:
    ConfFile: C:\Program Files\Oracle\BI Publisher\BI Publisher Desktop\Template Builder for Word\config\xdoconfig.xml
    Font Dir: C:\Program Files\Oracle\BI Publisher\BI Publisher Desktop\Template Builder for Word\fonts
    Run XDO Start
    Template: C:\Documents and Settings\jdenison\My Documents\BIP Templates\R5642001\R5642001_TEMPLsave.rtf
    RTFProcessor setLocale: en-us
    FOProcessor setData: C:\Documents and Settings\jdenison\My Documents\BIP Templates\R5642001\R5642001_RICE0001_D081029_T144059683.xml
    FOProcessor setLocale: en-us
    java.lang.reflect.InvocationTargetException
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at oracle.apps.xdo.common.xml.XSLT10gR1.invokeProcessXSL(Unknown Source)
         at oracle.apps.xdo.common.xml.XSLT10gR1.transform(Unknown Source)
         at oracle.apps.xdo.common.xml.XSLT10gR1.transform(Unknown Source)
         at oracle.apps.xdo.common.xml.XSLTWrapper.transform(Unknown Source)
         at oracle.apps.xdo.template.fo.util.FOUtility.generateFO(Unknown Source)
         at oracle.apps.xdo.template.fo.util.FOUtility.generateFO(Unknown Source)
         at oracle.apps.xdo.template.FOProcessor.createFO(Unknown Source)
         at oracle.apps.xdo.template.FOProcessor.generate(Unknown Source)
         at RTF2PDF.runRTFto(RTF2PDF.java:629)
         at RTF2PDF.runXDO(RTF2PDF.java:439)
         at RTF2PDF.main(RTF2PDF.java:289)
    Caused by: oracle.xdo.parser.v2.XPathException: Extension function error: Method not found 'sum'
         at oracle.xdo.parser.v2.XSLStylesheet.flushErrors(XSLStylesheet.java:1534)
         at oracle.xdo.parser.v2.XSLStylesheet.execute(XSLStylesheet.java:521)
         at oracle.xdo.parser.v2.XSLStylesheet.execute(XSLStylesheet.java:489)
         at oracle.xdo.parser.v2.XSLProcessor.processXSL(XSLProcessor.java:271)
         at oracle.xdo.parser.v2.XSLProcessor.processXSL(XSLProcessor.java:155)
         at oracle.xdo.parser.v2.XSLProcessor.processXSL(XSLProcessor.java:192)
         ... 15 more

  • Need Help With Custom Calculation Script

    Hey everyone.  I'm using Acrobat Pro X and stumbling a bit on the syntax for the following equation.  I need to add the value of "Cell1" & "Cell2" then add the value of "Cell3".  However,the value of "Cell3" is entered by the user and specifies a percentage of the sum of "Cell1 & "Cell2".  For example: If the user enters "3" into "Cell3" I need the returned value to be 3% of the sum of "Cell1" + "Cell2".  If the user enters "9" into "Cell3" I need the returned value for "Cell3" to be 9% of the sum of "Cell1 & Cell2" and the end result needs to be the sum of "Cell1+Cell2+Cell3".  In greater detail:
    If "Cell1" = $500, "Cell2" = $500 and "Cell3" = "3" then I need the returned value to be $1030.00.
    I hope this makes sense. Here's what I have so far but alas, it's not working.  Any help would be GREATLY appreciated.
    // Get first field value, as a number
    var v1 = +getField("Cell1").value;
    // Get second field value, as a number
    var v2 = +getField("Cell2").value;
    // Get processing field value, as a number
    //var v3 = +getField("Cell3"/100).value;
    // Calculate and set this field's value to the result
    event.value = v3+(v1+v2);
    Thanks,
    Solan

    I posted an answer but realized it wasn't what you wanted. There is some confusion about what you want for Cell3. On the one hand, you say you want the user to enter a vaule in the field, but them you say you want its value to be calculated based on what the user enters and two other field values. It seems to me Cell3 should be the field that the user enters the percentage and the calculated field's (Cell4) script could then be:
    // Get first field value, as a number
    var v1 = +getField("Cell1").value;
    // Get second field value, as a number
    var v2 = +getField("Cell2").value;// Get processing field value, as a number
    // Get the percentage
    var v3 = +getField("Cell3").value;
    // Calculate and set this field's value to the result
    event.value = (1 + v3 / 100) * (v1 + v2);

  • Need help with form calculations

    I'm converting a non-editable PDF form into an editable one and could use some help as I'm am new to this. Note: I did not create the non-editable form, It's a form I downloaded and use in my business.
    I already figured out how to create text fields in the already created PDF non-editable form, now I'm trying to add in calculations. I can create the (value is the) calculations between 2 or more text fields, but now I need to multiply one text field by the number 3 and have the answer show up in another text field.
    Example:
    I'll use the letters A & B for the text filed names in my example.
    I have text field A calculating the sum of other text fields using the (value is the sum of) option under the (calculate properties box.)
    Now I want text field B to multiply text field A by a fixed number of 3.  (A=24) x 3=72. I need text field B to have the answer of 72 in it.
    I need text field B to always multiply text field A by 3.
    Does anyone know how I can accomplish this?
    I'm using Adobe 8 Pro.
    Please note that I have no experiance using custom calculation script if that is the only way this will work and will step by step instruction on how to write the code.
    Thank you very much.

    You can use the simplified field notation option. In this case, you'd enter:
    3 * A
    Where "A" the the exact name of the A field. It is best to avoid spaces and any other special characters for any fields that you'll want to include when using simplified field notation option.

  • Help with table calculations

    Hi, all, I am working on a form that was previously made in Excel. I wanted to remake this in an expandable pdf fillable so that I can add the accessibiltiy information to the form. The first link is to the static pdf converted from Excel here:
    https://acrobat.com/#d=lIGyn*lpuWSQ-Qzkklml6w
    The second link is the the form as my strained brain has recreated it. I'm sure there is probably a better method than I have chosen and I am open to all suggestions. But I can't get the table to total.
    In the first table, all the calcs work correctly, ie 11, 12, 13, 14 and the total from 14 does show up in 15. but I need 17 to show the amount after the Discount (#16) is deducted. You would think something simple would do the trick, like SubTotal - Discount. That doesn't work.
    Column 19 should total in the footer row next to 21. It doesn't. And column 23 should total into space #24. I have been trying for hours at a time to come up with the magic script to make this form work but......now I've decided to grovel for help.
    https://acrobat.com/#d=mzovRUkKit7JnPVebPKgZw

    Hi,
    Here is your form back to you: https://acrobat.com/#d=a06D-SL7SK58ZulXCKNSuw. Please note that all of the scripts are FormCalc, as we are using the sum function and the wildcard. Neither of these will work in JavaScript.
    Have a look at this post on how to reference objects, in particular the deomonstration of Control+Click:
    http://www.assuredynamics.com/index.php/2011/05/som-expressions/
    Also with buttons with linear gradient I would change the click behaviour from Inverted to Outline or None. It will be a little easier on the eyes. I have changed the two Add buttons. Also I think that you are getting in to readibility issues with the contrast between the button background and the black caption. I would recommend a read of this post, which outlines an approach to primary buttons (like the add rows) and secondary buttons (like the delete rows):
    http://www.assuredynamics.com/index.php/2010/12/buttons/.
    Maybe this discussion on colours:
    http://www.assuredynamics.com/index.php/2011/02/any-colour-as-long-as-its-black/
    Hope that helps,
    Niall

Maybe you are looking for