How do you calculate a field

Hi all,
I would really appreciate some help as I do not know programing, java script or other programming languages.  I need to have a field calculate for me.
The form has date of birth. Then I need the next field, (a text field) calculate the age on the previous field of the Date of Birth.  Does anyone have an idea how to do that?  I have gone through the help guide, but it assume you know the langauage to put in.
thanks in advance.

Janet, I've fixed the form and attached the updated version.  There were a couple of things that I changed:
1. The form was saved as a static .pdf form.  This means that it's for display only; you can't run any scripts and change things programatically.  I changed it to be a dynamic form, which allows scripts to run when the user is entering data.  To do this I selected Save As from the file menu and then selected Save as type: Adobe Dynamic XML Form (*.pdf).
2. Since the form was saved as static it stripped out the scripts.  I re-pasted the script that I gave you back into the calculate event for the Age field.
I also changed the Language dropdown on the upper right side of the script window to Javascript, since that's the language that I used.
3. The name of your DOB field is DateTimeField1.  You can see this by either looking at the Hierarchy window or by looking at the Field tab of the Object window.  In the future you should change the names of the fields from their default to something more descriptive.  For now it's fine.  I then replaced my references to "DOB" in my script with "DateTimeField1.
4. Make sure that the preview type is set to dynamic.  Go to the File menu in designer and select the Form Properties item.  Click on the Preview tab and choose "Preview Type": Interactive Form and "Preview Adobe XML Form as": Dynamic XML form.
The above changes made it work, but I changed one more thing:  The type of the DOB field is set to DateTime field, and when you use the pop-up calendar to select the date it gets saved in the data in a backward format (YYY-MM-DD).  This doesn't show up on the form since you have the display format set, but behind the scenes it messes up the date calculation in the script.  I set the edit pattern for the field to be either D/M/YYYY or D-M-YYYY to allow some flexibility when the user enters the date, and to force it to save in the proper format for the script.
Oh, forgot to mention that "new Date()" gets the current date from the system, so you don't need a field on your form for it.  Green is a comment, not part of the script but just to document what's happening in the script.  Blue means reserved script instruction, black is everything else.  Makes more sense to you if you're a programmer. The Livecycle editor automatically colors the text to make it easier to read, we just type it in.
Give this a try and let me know if you have more issues.
Kevin

Similar Messages

  • How do you calculate multiple fields in a Form?

    Hi,
    I have a spreadsheet with several headings and several fields as illustrated below, and description of each field and calculation required is listed below.
    Rate Per Day
    Days
    Course
    Attending
    Total
    $1,000
    2
    Course A
    Yes
    $2,000
    $2,000
    1
    Course B
    Yes
    $2,000
    $5,000
    5
    Course C
    No
    $2,000
    2
    Course D
    Yes
    $4,000
    Total:
    $8,000
    Rate per day:  Field value is inputted by us.
    Days:  Field value is inputted by us.
    Course:  Field value is inputted by us.
    Attending:  Is actually a check-box that the client ticks.
    Course Total:  This should be the calculation of RATE PER DAY * DAYS IF ATTENDING BOX IS CHECKED
    Total:  Sum of above COURSE TOTAL FIELDS
    We currently do this in EXCEL 2007, however we looking at converting it to a PDF Form for distribution to our clients to we can track responses, etc.
    My question is really ery simple ... how do I create the above calculations in a form that I want to distribute??  This possible?? If so how (please bear in mind I'm not a developer

    In re-reading your question, I realized you're using a check box. In that case, you will need to create a custom calculation script using JavaScript.
    Something like:
    // This is a custom calculation script
    (function () {
        // Get the value of the check box
        var v1 = getField("Attending1").value;
        if (v1 !== "Off") {
            var v2 = +getField("Rate1").value;
            var v3 = +getField("Days1").value;
            // Sum the two field values and set the value of this field to the result
            event.value = v2 + v3;
        } else {
            // Blank field if checkbox is unchecked
            event.value = "";
    You'd replace the field names I used with the field names you're using.
    This leaves out checking to see if the corresponding Couse field is filled-in, and you'll have to use a custom Format script if you want the type of formatting you show.

  • How do you change the fields that are displayed on the email preview list after a search?

    How do you modify the fields that are displayed in the mail preview list in the center column of Mac mail after you conduct a search of your email?   All of a sudden the displayed fields changed on me whenever I do a search in mail.   When I have not filtered my email with a search, the default field shown in bold at the top of each message's preview is the "From" field.   However, when I do a search this changes to the "To" field.   Can anyone help?   Thanks, ccarey

    ipicus
    But why would you want this?
    iTunes is responsible for the File Management, let it get on with it, you do your organisation in the iTunes window. And everything you need to do, you can do via the iTunes Window. Want to find the file of a track quickly? Right click on it in the iTunes Window and select Show File: A finder window pops open with the file already selected.
    Regards
    TD

  • How do you add additional fields in infotypes?i want to leave blank space

    how do you add additional fields in infotypes?i want to leave blank space in front of the field?

    Hi,
    To add new fields go to PM01 and select Enhance Infotype option and then follow the steps in sequence.
    I am not getting blank space in front of the field. please elaborate it.
    Regards,
    Raja.D

  • How do you call a field?

    Good morning everyone,
    I'm trying to work with the BufferedInputStream (work from friday) and i went to the website:
    http://java.sun.com/j2se/1.4.2/docs/api/java/io/BufferedInputStream.html#BufferedInputStream(java.io.InputStream)
    at that website they have a "field summary" and i want to use the buf array (cause it says thats where the data is stored) but i cant figure out the coding to put it in my project. how do you call a field?

    Fr. Murderess,
    a) The short answer is "no". Only public methods and fields can be accessed that way.
    b) If getting the "buf" field is of paramount importance to you, declare a class like this:
    public class MyBufferedInputStream extends BufferedInputStream {
        public MyBufferedInputStream(InputStream in) { super(in); }
        public MyBufferedInputStream(InputStream in, int size) { super(in, size); }
        public byte[] getBuf() { return buf; }
        public void setBuf(byte[] newBuf) { buf = newBuf; }
    }to get and set the "buf" field. As you can see by reading the source code of BufferedInputStream, the other fields (count, pos and markpos) are needed too, and you will need to provide the getters and setters for the other fields.
    It's better not to "fiddle" with the protected fields of BufferedInputStream. Simply use BufferedInputStream "as is", and don't bother about the "buf" field.
    I think that you will need to tinker only with the size of the buffer (maybe to cache more data inside), but it is available in the second constructor of BufferedInputStream (InputStream in, int size).

  • I wanted to know how do you calculate the number of days between two dates

    i wanted to know how do you calculate the number of days between two dates in java ? i get both the dates from the database. i guess there are many issues like leap year and Febuary having diff no of months ..etc.

    thanks..
    I solve my problem as
    public class MyExample {
        public static void main(String a[]) {
            String stdate = "2009-03-01";
            java.sql.Date currentDate = new java.sql.Date(System.currentTimeMillis());
            java.sql.Date preDate = java.sql.Date.valueOf(stdate);
            System.out.println(currentDate);
            System.out.println(preDate);
    //        int dateCom = preDate.compareTo(currentDate);
    //        System.out.println(dateCom);
            long diff = currentDate.getTime() - preDate.getTime();
            int days = (int) Math.floor(diff / (24 * 60 * 60 * 1000));
             System.out.println(days);
    }

  • How do you know which fields are mandatory while uploading PO using BAPI.

    How do you know which fields are mandatory while uploading PO data using BAPI. in a structure how do you know which fields are mandatory.
    and also, where how do you check that, the BAPI function module is executed.
    Thanks in Advance.
    Naveen.

    hi
    hope it will help you.
    Reward if help.
    REPORT zpo_bapi_purchord_tej.
    DATA DECLARATIONS *
    TYPE-POOLS slis.
    TYPES: BEGIN OF ty_table,
    v_legacy(8),
    vendor TYPE bapimepoheader-vendor,
    purch_org TYPE bapimepoheader-purch_org,
    pur_group TYPE bapimepoheader-pur_group,
    material TYPE bapimepoitem-material,
    quantity(13),
    delivery_date TYPE bapimeposchedule-delivery_date,
    net_price(23),
    plant TYPE bapimepoitem-plant,
    END OF ty_table.
    TYPES: BEGIN OF ty_alv,
    v_legs(8),
    success(10),
    v_legf(8),
    END OF ty_alv.
    TYPES: BEGIN OF ty_alv1,
    v_legf1(8),
    v_msg(500),
    END OF ty_alv1.
    *-----Work area declarations.
    DATA: x_table TYPE ty_table,
    x_header TYPE bapimepoheader,
    x_headerx TYPE bapimepoheaderx,
    x_item TYPE bapimepoitem,
    x_itemx TYPE bapimepoitemx,
    x_sched TYPE bapimeposchedule,
    x_schedx TYPE bapimeposchedulx,
    x_commatable(255),
    x_alv TYPE ty_alv,
    x_alv1 TYPE ty_alv1,
    x_alv2 TYPE ty_alv1.
    *-----Internal table declarations.
    DATA: it_table TYPE TABLE OF ty_table,
    it_commatable LIKE TABLE OF x_commatable,
    it_item TYPE TABLE OF bapimepoitem,
    it_itemx TYPE TABLE OF bapimepoitemx,
    it_sched TYPE TABLE OF bapimeposchedule,
    it_schedx TYPE TABLE OF bapimeposchedulx,
    it_alv TYPE TABLE OF ty_alv,
    it_alv1 TYPE TABLE OF ty_alv1,
    it_alv2 TYPE TABLE OF ty_alv1.
    DATA: po_number TYPE bapimepoheader-po_number,
    x_return TYPE bapiret2,
    it_return TYPE TABLE OF bapiret2,
    v_file TYPE string,
    v_temp(8),
    v_succsount TYPE i VALUE 0,
    v_failcount TYPE i VALUE 0,
    v_total TYPE i.
    DATA: v_temp1(5) TYPE n VALUE 0.
    DATA: x_event TYPE slis_t_event,
    x_fieldcat TYPE slis_t_fieldcat_alv,
    x_list_header TYPE slis_t_listheader,
    x_event1 LIKE LINE OF x_event,
    x_layout1 TYPE slis_layout_alv,
    x_variant1 TYPE disvariant,
    x_repid2 LIKE sy-repid.
    DATA : it_fieldcat TYPE TABLE OF slis_t_fieldcat_alv.
    SELECTION-SCREEN *
    SELECTION-SCREEN BEGIN OF BLOCK v_b1 WITH FRAME.
    *-----To fetch the flat file.
    PARAMETERS: p_file TYPE rlgrap-filename.
    SELECTION-SCREEN END OF BLOCK v_b1.
    AT SELECTION-SCREEN *
    AT SELECTION-SCREEN.
    IF p_file IS INITIAL.
    MESSAGE text-001 TYPE 'E'.
    ENDIF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
    *-----To use F4 help to find file path.
    CALL FUNCTION 'F4_FILENAME'
    EXPORTING
    program_name = syst-cprog
    dynpro_number = syst-dynnr
    IMPORTING
    file_name = p_file.
    v_file = p_file.
    START-OF-SELECTION *
    START-OF-SELECTION.
    PERFORM gui_upload.
    LOOP AT it_table INTO x_table.
    PERFORM header_details.
    v_temp = x_table-v_legacy.
    LOOP AT it_table INTO x_table WHERE v_legacy = v_temp.
    PERFORM lineitem.
    PERFORM schedule.
    ENDLOOP.
    DELETE it_table WHERE v_legacy = v_temp.
    PERFORM bapicall.
    MOVE po_number TO x_alv-success.
    APPEND x_alv TO it_alv.
    CLEAR x_alv.
    *-----To clear the item details in internal table after the operation for a header.
    REFRESH: it_item,
    it_itemx,
    it_sched,
    it_schedx.
    CLEAR: v_temp1.
    ENDLOOP.
    v_total = v_succsount + v_failcount.
    PERFORM display_alv.
    FORM GUI_UPLOAD *
    FORM gui_upload .
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = v_file
    filetype = 'ASC'
    TABLES
    data_tab = it_commatable
    EXCEPTIONS
    file_open_error = 1
    file_read_error = 2
    no_batch = 3
    gui_refuse_filetransfer = 4
    invalid_type = 5
    no_authority = 6
    unknown_error = 7
    bad_data_format = 8
    header_not_allowed = 9
    separator_not_allowed = 10
    header_too_long = 11
    unknown_dp_error = 12
    access_denied = 13
    dp_out_of_memory = 14
    disk_full = 15
    dp_timeout = 16
    OTHERS = 17
    IF sy-subrc = 0.
    *-----To fetch the comma seperated flat file into an internal table.
    LOOP AT it_commatable INTO x_commatable.
    IF x_commatable IS NOT INITIAL.
    SPLIT x_commatable AT ',' INTO
    x_table-v_legacy
    x_table-vendor
    x_table-purch_org
    x_table-pur_group
    x_table-material
    x_table-quantity
    x_table-delivery_date
    x_table-net_price
    x_table-plant.
    APPEND x_table TO it_table.
    ENDIF.
    CLEAR x_table.
    ENDLOOP.
    ENDIF.
    ENDFORM. " gui_upload
    FORM HEADER_DETAILS *
    FORM header_details .
    MOVE 'NB' TO x_header-doc_type.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
    input = x_table-vendor
    IMPORTING
    output = x_table-vendor
    MOVE x_table-vendor TO x_header-vendor.
    MOVE x_table-purch_org TO x_header-purch_org.
    MOVE x_table-pur_group TO x_header-pur_group.
    x_headerx-doc_type = 'X'.
    x_headerx-vendor = 'X'.
    x_headerx-purch_org = 'X'.
    x_headerx-pur_group = 'X'.
    ENDFORM. " header_details
    FORM LINEITEM *
    FORM lineitem .
    v_temp1 = v_temp1 + 10.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
    input = v_temp1
    IMPORTING
    output = v_temp1.
    MOVE v_temp1 TO x_item-po_item.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
    input = x_table-material
    IMPORTING
    output = x_table-material.
    MOVE x_table-material TO x_item-material.
    MOVE x_table-quantity TO x_item-quantity.
    MOVE x_table-net_price TO x_item-net_price.
    MOVE x_table-plant TO x_item-plant.
    x_itemx-po_item = v_temp1.
    x_itemx-material = 'X'.
    x_itemx-quantity = 'X'.
    x_itemx-net_price = 'X'.
    x_itemx-plant = 'X'.
    APPEND x_item TO it_item.
    APPEND x_itemx TO it_itemx.
    CLEAR: x_item, x_itemx.
    ENDFORM. " lineitem1
    FORM SCHEDULE *
    FORM schedule .
    MOVE x_table-delivery_date TO x_sched-delivery_date.
    MOVE v_temp1 TO x_sched-po_item.
    x_schedx-delivery_date = 'X'.
    x_schedx-po_item = v_temp1.
    APPEND x_sched TO it_sched.
    APPEND x_schedx TO it_schedx.
    CLEAR: x_sched, x_schedx.
    ENDFORM. " schedule
    FORM BAPICALL *
    FORM bapicall .
    CALL FUNCTION 'BAPI_PO_CREATE1'
    EXPORTING
    poheader = x_header
    poheaderx = x_headerx
    IMPORTING
    exppurchaseorder = po_number
    TABLES
    return = it_return
    poitem = it_item
    poitemx = it_itemx
    poschedule = it_sched
    poschedulex = it_schedx.
    IF po_number IS NOT INITIAL.
    v_succsount = v_succsount + 1.
    MOVE x_table-v_legacy TO x_alv-v_legs.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
    ELSE.
    v_failcount = v_failcount + 1.
    MOVE x_table-v_legacy TO x_alv-v_legf.
    MOVE x_table-v_legacy TO x_alv1-v_legf1.
    LOOP AT it_return INTO x_return.
    IF x_alv1-v_msg IS INITIAL.
    MOVE x_return-message TO x_alv1-v_msg.
    ELSE.
    CONCATENATE x_alv1-v_msg x_return-message INTO x_alv1-v_msg SEPARATED BY space.
    ENDIF.
    ENDLOOP.
    APPEND x_alv1 TO it_alv1.
    CLEAR x_alv1.
    ENDIF.
    ENDFORM. " bapicall
    FORM DISPLAY_ALV *
    FORM display_alv .
    PERFORM x_list_header.
    PERFORM build_fieldcat CHANGING x_fieldcat.
    x_repid2 = sy-repid.
    x_event1-name = 'TOP_OF_PAGE'.
    x_event1-form = 'TOP_OF_PAGE'.
    APPEND x_event1 TO x_event.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = x_repid2
    is_layout = x_layout1
    it_fieldcat = x_fieldcat
    i_callback_user_command = 'USER_COMMAND'
    i_callback_top_of_page = 'TOP_OF_PAGE'
    i_save = 'A'
    is_variant = x_variant1
    it_events = x_event
    TABLES
    t_outtab = it_alv
    EXCEPTIONS
    program_error = 1
    OTHERS = 2.
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    ENDFORM. " display_master_data
    FORM USER_COMMAND *
    FORM user_command USING ucomm LIKE sy-ucomm selfield
    TYPE slis_selfield.
    READ TABLE it_alv INTO x_alv INDEX selfield-tabindex.
    CLEAR : x_alv2,it_alv2[].
    LOOP AT it_alv1 INTO x_alv1 WHERE v_legf1 = x_alv-v_legf.
    x_alv2 = x_alv1.
    APPEND x_alv2 TO it_alv2 .
    ENDLOOP.
    DATA : it_fieldcat TYPE slis_t_fieldcat_alv.
    DATA : x3_fieldcat LIKE LINE OF it_fieldcat.
    CLEAR : x3_fieldcat,it_fieldcat[].
    CLEAR x3_fieldcat.
    x3_fieldcat-col_pos = '1'.
    x3_fieldcat-fieldname = 'V_LEGF1'.
    x3_fieldcat-reptext_ddic = text-111.
    x3_fieldcat-ref_tabname = 'IT_ALV2'.
    APPEND x3_fieldcat TO it_fieldcat.
    CLEAR x3_fieldcat.
    CLEAR x3_fieldcat.
    x3_fieldcat-col_pos = '1'.
    x3_fieldcat-fieldname = 'V_MSG'.
    x3_fieldcat-reptext_ddic = text-112.
    x3_fieldcat-ref_tabname = 'IT_ALV2'.
    APPEND x3_fieldcat TO it_fieldcat.
    CLEAR x3_fieldcat.
    x_layout1-colwidth_optimize = 'X'.
    x_layout1-zebra = 'X'.
    IF it_alv2[] IS NOT INITIAL.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = x_repid2
    is_layout = x_layout1
    it_fieldcat = it_fieldcat
    i_save = 'A'
    i_callback_top_of_page = 'TOP'
    is_variant = x_variant1
    it_events = x_event
    TABLES
    t_outtab = it_alv2
    EXCEPTIONS
    program_error = 1
    OTHERS = 2.
    ENDIF.
    ENDFORM.
    FORM USER_COMMAND *
    FORM top.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    it_list_commentary = 'Commentry'.
    ENDFORM.
    FORM BUILD_FIELDCAT *
    FORM build_fieldcat CHANGING et_fieldcat TYPE slis_t_fieldcat_alv.
    DATA: x1_fieldcat TYPE slis_fieldcat_alv.
    CLEAR x1_fieldcat.
    x1_fieldcat-col_pos = '1'.
    x1_fieldcat-fieldname = 'V_LEGS'.
    x1_fieldcat-reptext_ddic = text-108.
    x1_fieldcat-ref_tabname = 'IT_ALV'.
    APPEND x1_fieldcat TO et_fieldcat.
    CLEAR x1_fieldcat.
    x1_fieldcat-col_pos = '2'.
    x1_fieldcat-fieldname = 'SUCCESS'.
    x1_fieldcat-key = 'X'.
    x1_fieldcat-reptext_ddic = text-109.
    x1_fieldcat-ref_tabname = 'IT_ALV'.
    APPEND x1_fieldcat TO et_fieldcat.
    CLEAR x1_fieldcat.
    x1_fieldcat-col_pos = '3'.
    x1_fieldcat-fieldname = 'V_LEGF'.
    x1_fieldcat-key = 'X'.
    x1_fieldcat-reptext_ddic = text-110.
    x1_fieldcat-ref_tabname = 'IT_ALV'.
    APPEND x1_fieldcat TO et_fieldcat.
    CLEAR x1_fieldcat.
    ENDFORM. " build_fieldcat
    FORM BUILD_LIST_HEADER *
    FORM x_list_header.
    DATA: x_list_header1 TYPE slis_listheader.
    *-----List Header: type H
    CLEAR x_list_header1 .
    x_list_header1-typ = 'H'.
    x_list_header1-info = text-105.
    APPEND x_list_header1 TO x_list_header.
    *-----List Key: type S
    x_list_header1-typ = 'S'.
    x_list_header1-key = text-106.
    x_list_header1-info = v_total.
    APPEND x_list_header1 TO x_list_header.
    *-----List Key: Type S
    CLEAR x_list_header1 .
    x_list_header1-typ = 'S'.
    x_list_header1-key = text-107.
    x_list_header1-info = v_succsount.
    APPEND x_list_header1 TO x_list_header.
    ENDFORM. " build_list_header
    FORM TOP_OF_PAGE *
    FORM top_of_page.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    it_list_commentary = x_list_header.
    ENDFORM. " TOP_OF_PAGE

  • How do you calculater correlation coefficients for data?

    I would like to calculate the correlation coefficient for data which has a linear correlation. I can calculate the linear fit, but how do you calculate the correlation coefficient from this data. Any help would be greatly appreciated.

    If you're just looking for the correlation coefficient (r^2 or r) of a linear regression, you can use the method described HERE earlier.
    LabVIEW Champion . Do more with less code and in less time .

  • How do you calculate the count in before a cue start?

    Here's what I can't figure out.
    I have a quicktime loaded and I need to start a cue at, let's say, 1:05:07:10. I want the tempo to be, oh, 120. I arbitrarily say - this will be measure 41 but it doesn't really matter, I just need my downbeat at that TC and the tempo to be correct.
    So far so good. I have no problem doing this with Tempo operations. I lock the time code, assign it a measure (in this case 41) and have logic calculate a single tempo from 1:00:00:00 (measure 1) to the desired start.
    Now here's my real question. How do I calculate 4 or 8 beats before 1:05:07:10 so I can have a count it at the correct tempo (120)?
    So I'm wonder how some of y'all handle this situation.
    Thanks

    As long as you are in the Fetch call, all other calls to the Scope
    driver will block until Fetch exits.  That's why the Abort doesn't
    do anything.  You have two options:
      1) Use a finite timeout.  Obviously, you are running into
    cases in which the trigger does not arrive, and want to exit
    cleanly.  This is exactly what the timeout is for.
      2) Determine the acquisition state before calling fetch. 
    If this is a finite, single-record acquisition, poll on acquisition
    status and do not call fetch until the status is 1 (acquisition
    complete).  If you're doing a finite, multi-record acquisition,
    poll on the Fetch>>Records Done property and only fetch the
    records that have completed.  If you're doing a continuous
    acquisition, poll on the Fetch>>Points Done or Fetch>>Fetch
    Backlog property and only fetch the number of points that have been
    acquired.
    There's no clean way to break the infinite timeout fetch without forcing LabVIEW to close.

  • How do you output a field column depending on another fields value?

    when selecting a field in a query, how do you output it on its own column depending on another fields value?
    For example
    Select
    a.gross_vol as Gas_vol when a.Object_code = "GAS"
    a.gross_vol as Wat_Vol when a.object_code = "water"

    how do you output it on its own column depending on another fields value?Scalar subquery maybe?:
    michaels>  select (select ename from emp where empno = 7788) scott_ename,
           (select ename from emp where empno = 7839) king_ename
      from dual
    SCOTT_ENAM KING_ENAME
    SCOTT      KING 

  • How do you calculate accumulated displacement?

    Hello! I would like to calculate the amount of displacment accumulated during a laboratory test using LVDT positions. Acquiring the signal and determining the position is no problem. However, I cannot think of an efficient way to sum the displacement measured by the LVDTs during the test period. From a progamming standpoint, I would simply save an initial value and subtract the current loop value to obtain the displacement. In the attached example I use a method which uses a case structure and a shift register, but it seems a bit brute force. Do you know of a more elegant way of doing this? If not, how do I tidy it up?
    Attachments:
    LVDT_displacement.vi ‏145 KB
    LVDT_DAQ_Assistant.PNG ‏22 KB

    Evan,
    Create control will create arrays on Add or Multiply only if an array is wired to one of the other terminals. Did you have the array from DDT wired to the Multiply (without the Index Array) when you first created the slope and intercept controls?  If you do not want arrays, go to the front panel, delete the array controls, and drop scalar controls on their places. Then wire the terminals to the numeric functions on the block diagram. Everything should then be scalars.
    It looks like the DAQ Assistant is set to acquire data from two channels at 1000 samples per second and to retrieve 100 samples on each call.
    When you convert from DDT to 1D array of DBL you get only one of the two channels. The array should contain 100 points from the first channel. All of the data from the second channel is lost. You then index out the first and second elements of the array from the first channel.
    I doubt that this is what you really wanted to do.
    The DAQmx VIs will give your direct control over the datatypes and eliminate the extra overhead of the DAQ Assistant.
    You should be able to configure the From DDT to allow you to select the channels. Double click to bring up the configuration dialog. You can select 2D array of scalars and then use Index Array to get the channel you want. Another option is to use 2 copies of From DDT and select 1D array of scalars - single channel. Then choose the channel with the control below the Scalar Data Type box.
    Once you get the arrays configured correctly I suggest that you calculate the Mean of each array and use that for your single value per iteration. Averaging the 100 points should significnatly reduce any noise on the signal.
    Lynn

  • How do you add a field to the address of a contact?

    YYou used to be able to add an extra line to an address. I cannot now do that. How can you with iOS 8?

    Go to Contacts>Preferences>Templates, where can

  • How do you make a field in RBKP mandatory

    Hi.
    I need to make ESRNR and ESRRE fields in RBKP mandatory. But before then, were do you check if this fields are optional, mandatory or supressed. In other words where do you check the fields status group on this field.
    Thanks

    Hi Olany,
    For this query you have to go sustitution rule in a particular field .Check with ABAPer for this why because for that some programme knowledge required.
    if u want check the field status group before  which field status you given in gl master,posting key check it and go to the t.code OBC4  for field status
    May be this information is useful to you
    Regards
    Surya

  • How do you call dynamic fields in Report Builder

    I have some fields that they were filled in a dynamic way,
    and I want to make some calculations using the information that was
    populated in this field. When I put the name of the field in my
    calculation control, it did not see find the field control.
    Does anyone know how can I call the field control? The
    information is not part of any particular column of the
    query.

    check out the Oracle Portal Tutorial White Paper (http://technet.oracle.com/docs/products/iportal/listing.htm#tutcase), there is a section where they build a report with repeating fields

  • How do you calculate difference in time (hours and minutes) between 2 two date/time fields?

    Have trouble creating formula using FormCalc that will calculate difference in time (hours and minutes) from a Start Date/Time field and End Date/Time field. 
    I am using to automatically calculate total time in hours and minutes only of an equipment outage based on a user entered start date and time and end date and time. 
    For example a user enters start date/time of an equipment outage as 14-Oct-12 08:12 AM and then enters an end date/time of the outage of 15-Oct-12 01:48 PM.  I need a return that automatically calculates total time in hours and minutes of the equipment outage.
    Thanks Chris

    Hi,
    In JavaScript you could do something like;
    var DateTimeRegex = /(\d\d\d\d)-(\d\d)-(\d\d)T(\d\d):(\d\d)/;
    var d1 = DateTimeRegex.exec(DateTimeField1.rawValue);
    if (d1 !== null)
        var fromDate = new Date(d1[1], d1[2]-1, d1[3], d1[4], d1[5]);
    var d2 = DateTimeRegex.exec(DateTimeField2.rawValue);
    if (d2 !== null)
        var toDate = new Date(d2[1], d2[2]-1, d2[3], d2[4], d2[5]);
    const millisecondsPerMinute = 1000 * 60;
    const millisecondsPerHour = millisecondsPerMinute * 60;
    const millisecondsPerDay = millisecondsPerHour * 24;
    var interval = toDate.getTime() - fromDate.getTime();
    var days = Math.floor(interval / millisecondsPerDay );
    interval = interval - (days * millisecondsPerDay );
    var hours = Math.floor(interval / millisecondsPerHour );
    interval = interval - (hours * millisecondsPerHour );
    var minutes = Math.floor(interval / millisecondsPerMinute );
    console.println(days + " days, " + hours + " hours, " + minutes + " minutes");
    This assumes that the values in DateTimeField1 and DateTimeField2 are valid, which means the rawValue will be in a format like 2009-03-15T18:15
    Regards
    Bruce

Maybe you are looking for

  • Youtube Autoplay not working in the background!

    Why isn't autoplay of youtube videos not running in the background of Safari? It works fine in Firefox or Chrome, but in Safari, everytime a video is done, I have to make the youtube tab active for it to start playing the next video in the playlist.

  • MOF Syntax Error Installing SQL Server 2014 Express

    I am trying to install SQL Server 2014 Express With Tools on a fully updated Win 8.1 system having already installed Visual Studio Community 2013 with Update 4. During the installation of SQL Server, I am getting a "MOF Syntax Error". I found this ht

  • Restrict fields in advanced search

    Hi, afaik you should be able to restrict the fields exposed to the user in the advanced search with R18. I am not able to find the place to configure this. Any hints? Thanks in advance Michael

  • Converting .flv files?

    Source file = .flv downloaded from Twitch TV Need = to convert the .flv file to a format that I can edit in Final Cut Pro 10.0.6 End Result Desired = to posted editted version in format that will play on YouTube When I download the .flv file, the aud

  • VERY weird iTunes syncing issue

    Here's my issue...I need to give a bit of background but I'll be brief. About 4 months ago a friend gave me an album on a USB drive. Loaded into my iTunes and synced to my iPhone. No issues. About 3 weeks ago, I noticed that on my phone I now had 2 c