Calculation with conditional clauses

Hello

I have a rather complicated in an Acrobat form calculation cannot get away without writing any javascript. The problem is that I do not know how to write javascript!

So if there's someone here who is somehow quite help me, I would certainly appreciate it!

Here are the conditions:

SUM is a sum of many other areas which is given here, TOTAL is the value that we have to calculate.

If the SUM is less than 1500, the TOTAL should be SUM

If the SUM is between 1500 and 1875, the TOTAL should be 1500.

If the SUM is between 1875 and 2500, the TOTAL should be SUM * 0.8

If the SUM is between 2500 and 3400, TOTAL should be 2500

If the SUM is greater than 3400, TOTAL should be SUM * 0.75

I guess this requires javascript on some fields and also at the level of the document, so please let me know where to put them!

Thank you 1 million,

Mark

For the "TOTAL" field, you can use the following custom calculation script:

fSum var = this.getField('SUM').value; get the value of the field named "SUM".

{Switch (true)}

case (fSum< 1500)="">

less than 1500

this.getField('TOTAL').value = fSum; total is the sum

break; output test

case (fSum<>

sum< 1875="" -="" we="" have="" already="" taken="" care="" of =""><>

this.getField('TOTAL').value = 1500; total is 1500

break; output test

case (fSum<>

sum< 2500="" -="" we="" have="" already="" taken="" care="" of=""><>

this.getField('TOTAL').value = fSum * 0.8; total is 80% of the sum

break; output test

case (fSum<>

sum< 3400="" -="" we="" have="" already="" taken="" care="" of="" ,="">

this.getField('TOTAL').value = 2500; total is about 2500

break; output test

by default:

only 3400 and upper-left

this.getField('TOTAL').value = fSum * 0.75; total is 75% of the sum

break; output test

} / / end of all tests

Tags: Acrobat

Similar Questions

  • Calculation of the sum with condition

    Hello
    I start with BI publisher, and I want to take a NAP with condition.

    My report output XLS, I haves columns, named ACCOUNT_TYPE and TREE_NODE and MOENTARY_AMOUNT_03 that are my PS query fields

    I want to sum only when a condition is true.

    <? xdofx:If ACCOUNT_TYPE = 'R' AND TREE_NOD = 'TEST' then
    Sum (MONETARY_AMOUNT_03)
    end if? >

    This does not,
    could you help me?

    thaks!

    You should do this:

  • WITH THE CLAUSE

    Hi all

    I'm using oracle 11.2.0.4

    I m using this for the purpose of learning

    Below is my table and insert statement

    CREATE TABLE COMPANY (NUMBER EMPLOYEE_ID, EMPLOYEE_NAME VARCHAR2 (30), NUMBER OF MANAGER_ID)

    INSERT INTO THE COMPANY'S VALUES (1, 'FRED', ");

    SOCIETY VALUES (2, 'BARNEY', '1');

    SOCIETY VALUES (3, 'WILMA', '1');

    SOCIETY VALUES (4, 'BETTY', '3');

    INSERT IN THE VALUES(5,'PEBBLES','3') SOCIETY;

    INSERT IN THE VALUES(6,'BAM-BAM','4') SOCIETY;

    INSERT IN THE VALUES(7,'DINO','4') SOCIETY;

    INSERT IN THE VALUES(8,'HOPPY','4') SOCIETY;

    WITH RSFC(CK,PK,LVL,HIER) AS

    (SELECT EMPLOYE_ID, MANAGER_ID, 0 AS LVL, EMPLOYEE_NAME LIKE YESTERDAY)

    SOCIETY

    WHERE MANAGER_ID IS NULL

    UNION ALL

    SELECT EMPLOYE_ID, MANAGER_ID, LVL + 1, YESTERDAY. '/' || EMPLOYEE_NAME

    OF THE RSFC R INNER JOIN COMPANY F

    ON R.CK = F.MANAGER_ID

    )

    WIDTH OF SEARCH FIRST BY CK ORDR SET

    SELECT A.LVL, A.CK, A.PK, A.HIER, ORDR

    THE RSFC HAS

    ORDER BY ORDR

    01FRED1
    121FRED/BARNEY2
    131FRED/WILMA3
    243FRED/WILMA/BETTY4
    253FRED/WILMA/PEBBLES5
    364FRED/WILMA/BETTY/BAM-BAM6
    374FRED, WILMA, BETTY, DINO7
    384FRED, WILMA, BETTY, HOPPY8

    First part, I believe, as well, explains Frank

    hierarchical queries

    next part in bold, I need to understand

    Thanks and respect.

    Guylaine

    Hi, lyly,

    You said that you did not understand the part highlighted in your query.  It looks like the 2 lines are highlighted:

    WIDTH OF SEARCH FIRST BY CK ORDR SET

    SELECT A.LVL, A.CK, A.PK, A.HIER, ORDR

    I guess that it's a typo.  The 2nd day of these lines is just the main SELECT clause; This is the 1st line, the clause of the SEARCH, who really needs an explanation.

    As far as I know, the SEARCH clause is only for the sorting of the results.  In other words, the a WITH recursive clause results will be the same, no matter what you put in the SEARCH clause, or if you omit the clause of RESEARCH.  The only purpose of the clause of RESEARCH is to generate the column command (ORDR in your example), which reflects where each row fits in the graph defined by your recursive query.  (Maybe, if you use non-deterministic user-defined functions, it can be a difference in the results.  Chances are, you never have to worry about this).

    If you do not use a clause in RESEARCH at all, it seems like by default

    WIDTH OF SEARCH FIRST BY NULL...

    In other words, the lines appear in order by level and in no particular order after that.  In your case, that would mean 'FRED' would come first, then "BARNEY" and "WILMA" (not necessarily in that order), followed by all the children of 'BARNEY' or 'WILMA' and so on.  No column order would be generated, so you could not guarantee order in the ORDER BY clause.

    I'm not sure that there is nothing you can do with a clause of RESEARCH that you can not do without a.  In other words, the SEARCH clause automatically generates a command column.  I believe you can still create an equivalent ordering column in the recursive query itself.  In your example, you could say

    ORDER BY lvl, ck

    to get the results sorted the same way.  Sometimes, using a SEARCH clause is much more convenient, and I bet that sometimes it is therefore more effective, too.

    2937991 wrote:

    Hi all

    I'm using oracle 11.2.0.4

    I m using this for the purpose of learning

    Below is my table and insert statement

    CREATE TABLE COMPANY (NUMBER EMPLOYEE_ID, EMPLOYEE_NAME VARCHAR2 (30), NUMBER OF MANAGER_ID)

    INSERT INTO THE COMPANY'S VALUES (1, 'FRED', ");

    SOCIETY VALUES (2, 'BARNEY', '1');

    ...

    As always, thank you for posting this information: it really helps!

    Manager_id is a NUMBER, it would be better if you don't quote it.  In other words, it would be more clear, more effective and less prone to say:

    INSERT INTO COMPANY (EMPLOYE_ID, EMPLOYEE_NAME, MANAGER_ID) VALUES (1, 'FRED', NULL);

    INSERT INTO COMPANY (EMPLOYE_ID, EMPLOYEE_NAME, MANAGER_ID) VALUES (2, 'BARNEY', 1);

    ...

    In this example, the unnecessary quotation marks do not hurt a lot, but they do not help all.

  • What is the significance of the CURSOR WITH HOLD clause in a cursor declaration?

    What is the significance of the CURSOR WITH HOLD clause in a cursor declaration?

    A cursor that has been declared with the clause WITH HOLD, after the word CURSOR remains open after a COMMIT or a ROLLBACK. The following example shows how to use the following clause:

         EXEC SQL          DECLARE C1 CURSOR WITH HOLD          FOR SELECT ENAME FROM EMP          WHERE EMPNO BETWEEN 7600 AND 7700      END-EXEC.
    

    The cursor must not be declared for the UPDATE. The WITH HOLD clause is used in DB2 to override the default, which is to close all cursors on validation. Pro * COBOL provides this clause in order to facilitate the migration of applications to DB2 to Oracle. When MODE = ANSI, use Oracle DB2 default, but all host variables must be declared in a declare Section.

    Reference:

    Oracle documentation!
    http://docs.Oracle.com/CD/B10501_01/AppDev.920/a96109/pco03dbc.htm

  • Where to write the condition in the design of workflows with conditional step?


    Hello

    Again, I wish BP and workflow with contitional design stage.

    I had designed BP and workflow.

    As directed by the user for Udesigner guide, I had added trigger before the condition step.

    But I do not understand where to set the Condition to test?

    If I need to write the condition in triggering elemt itsel... How to proceed?

    for example, I want to write the condition as cost of Tota > = 100000, it must follow a path and if fails to another path.

    The conditions of triggers are specified in the workflow settings.  After you have created a new configuration, open it and click on the settings tab.  You will see a tree structure of the workflow with conditional branches.  Click a conditional branch to set the parameters for the trigger for this route condition.

  • join with condition

    Hi all

    Is there a possible way to cross the join with condition?

    I want something like this:

    Table A: custid, accu_id, sum

    CustID, accu_id unique =

    CustomerID amount accu_id

    10 25 400

    10 35 447

    10 29 420

    20 30 510

    30 35 472

    .

    .

    .

    Table b: accu_id, description

    accu_id description

    shoes 25

    Book 29

    30 computer

    pen 35

    Note: in table A, it is a mismatch of the accu_id values that do not use. Please, take into account this.

    I want to see all the columns in the TABLE B for each custid in A. TABLE (something like cross join but with ONE article.) The following query does not work.

    Select * from a right join B on A.accu_id = B.accu_id;

    10-25

    10-29

    10-30

    10-35

    20-25

    20-29

    20-30

    20-35

    30 25

    30 29

    30 30

    30-35

    What should I do for this?

    Thanks in advance

    Use partition outer join:

    with a (too)

    Select double union all 10 custid, accu_id 25, amount 400

    Select 10,35,447 from all the double union

    Select 10,29,420 from all the double union

    Select 20,30,510 from all the double union

    Select double 30,35,472

    ),

    b like)

    Select accu_id 25, "shoe" description of all the double union

    Select 29, 'book' from dual union all

    Select 30, 'computer' from dual union all

    Select 35, 'pen' from dual

    )

    Select a.custid,

    a.accu_id,

    a.amount,

    b.

    a

    by (a.custid) partition

    right join

    b

    On a.accu_id = b.accu_id

    order of a.custid,

    a.accu_id

    /

    AMOUNT ACCU_ID CUSTID DESCRIPT
    ---------- ---------- ---------- --------
    10 25 400 shoe
    10 29 420 book
    10 35 447 pen
    10 computer
    20 30 510 computer
    shoe 20
    book 20
    20                       pen
    30 35 472 pen
    30 shoe
    30 book

    AMOUNT ACCU_ID CUSTID DESCRIPT
    ---------- ---------- ---------- --------
    30 computer

    12 selected lines.

    SQL >

    SY.

  • Reactive layouts: publish multiple Sites with conditional Builds and which connect

    I hope that someone can provide a simple solution to publish problems I've had with adapted presentations when you try to publish several sites with conditional builds. Essentially, I want to be able to have an index page that links to one of the two variants of the published sites that I called 'General' and 'specific '. When I click on the 'general' link I want to not open the site which was published with a conditional for all these subjects compilation labeled as 'general' and when I click on the 'link' want it to open the site which was published using a conditional version for 'specific '.

    Here are the steps I took to create sites and can't seem to get to bind correctly:

    Table of contents, topic Creation and tagging content

    1. Creates a Table of contents.
    2. Added 2 topics in the Table of contents. The first topic, I called "general" and the second issue I called, 'specific '.
    3. I then click with the right button on the "general" and selected subject Tag to build conditional apply. From there, I've created a new tag called "General".
    4. I repeated this process to create the specific tag, but do a right-click on the 'specific' theme and the creation of a new tag called "specific".

    Layouts reactive and edited the sites based on the conditional tags

    1. Created sensitive presentation using the standard layout and content generated without any conditional builds.
    2. Duplicated sensitive put in page and gave him the content of 'general' then it is generated using the conditional, "General" version If the finished publication published content has shown that the 'general' subject, as expected.
    3. I then repeated the same process for the specific content and content using the version parole, generated 'specific '. When over content published showed that the subject marked as 'specific' as expected.

    Added an Index page to the table of contents

    1. Created a new topic to serve as the launch page.
    2. Added a 'general' hyperlink called for the launch of the general "theme found in the general publishes from the resource manager.
    3. Added a hyperlink called 'specific' to the launch of the general "theme found in the specific issues from the resource manager.
    4. I then republish the sensitive standard layout site.

    From this point, it gets stuck and won't open properly published Web sites. I don't know why it won't launch hyperlinks correctly. Is there something I'm missing? Let me know if you do not want to see my files. I will be gladly their.

    OK, thanks a lot for the capture screen. They help more than you realize.

    So here's one of the biggest mistakes I think that you have done so far. You use the resource manager to link to published results. If it is technically possible to do, I'm pretty sure Adobe never planned for it to be used this way.

    It may help to think in terms of creation of food products. I have long considered as RoboHelp to be very much like working in my kitchen. All consumables (heading text in the headings, images, HTML pages, etc.) are just as raw ingredients. (Eggs, milk, flour, etc.). The places of storage (hard drive) it's like the pantry and the fridge. And RoboHelp provides facilities to easily combine ingredients to create the different recipes.

    This next bit will be somewhat exaggerated, but bear with me. Maybe you have one or more neighbors and all you want to share some common "ingredients". If you set the things where each of you have access to a wine cellar and a shared refrigerator. Maybe you do a Dutch sauce killer. You create it and place in the refrigerator, then your other participants have access through the common "fridge". This is exactly what the resource manager is intended to help.

    Now assume that you create something like cookies chocolate chip and you keep in the refrigerator. Well, that's fine, but you don't want to use cookies to chocolate chip already baked in a recipe that might call for cookie dough. But that's what happens when you take an exit and place in a place intended for raw ingredients. And you will see the strange behavior. Prepare for these cookies chemically changes them so that cookies already are significantly different from the dough used to create them. Similarly, you don't want to take one or more output files and reuse in a project source.

    So in your case, you run an index file and that fires events to produce the output. All should be well. But when you click on the links to open topics, topics are intended to show up more in the right panel. Think of the picture of how works of image on a TV. The moment that link you to something intended to fill the screen, he is forced into this smaller area on the right. If you end up with what you see in the last picture.

    I suggest the following steps.

    First, REMOVE your resource manager exits.

    REMOVE all links that can point here.

    Output records where people will consume copy your projects. (The web server)

    Then figure either the parent (.. /.. / somefolder/somefile.htm) path to other systems or the absolute path (http://www.whatever.com) and to link the projects in this way.

    Sorry, but without seeing the installation of first hand, it is difficult to say what should be these paths.

    I hope this was helpful... Rick

  • SQL with conditions

    Hello

    I need to generate a summary table with conditions. Here are the details:

    create the table tb_class (classId number (5), studentNum number (5));

    create table tb_grade (classId number (5), gradeNum number (5)):

    insert into table values tb_class (101, 100);

    insert into table values (201, 102) tb_class;

    insert into table values (102, 103) tb_class;

    insert into table values tb_grade (101, 1);

    insert into table values (102, 1) tb_grade;

    insert into table values (201, 2) tb_gradfe;

    I would like to get the total number of students registed in a specific shade with a SQL, the result is expected as follows:

    GradeNum studentNumRegistered studentNumNonRegisted

    1                         203                                      102

    2                         102                                      203

    Is that what you are looking for?

    WITH subsum AS
     (SELECT tb_grade.gradenum,
             SUM(tb_class.studentnum) AS students
      FROM   tb_class
      JOIN   tb_grade ON tb_grade.classid = tb_class.classid
      GROUP  BY tb_grade.gradenum)
    SELECT subsum.gradenum,
           SUM(subsum.students) AS studentnumregistered,
           SUM(subsum1.students) AS studentnumnonregistered
    FROM subsum
    JOIN subsum subsum1 ON subsum1.gradenum != subsum.gradenum
    GROUP  BY subsum.gradenum;
    
  • How to avoid duplicates on a column with condition

    Hi all

    I need some advice here. At work, we have an Oracle APEX application that allow the user to add new records with the decision of the increment automatic number based on the year and the group name.

    Said that if they add the first record, group name AA, for 2012, they get the decision number AA 1 2013 as their record casein displayed page of the report.

    The second record of AA in 2013 will be AA 2 2013.

    If we add about 20 records, it will be AA 20 2013.

    The first record for 2014 will be AA 1 2014.

    However, recently, we get a claim of the user on two files of the same name of group have the same number of the decision.

    When I looked in the history table and find that the time gap between 2 record is about 0.1 seconds.

    In addition, we have the correspondence table which allows the user admin update the sequence number start with the restraint that it must be greater than the maximum number of the current name of the current year.

    This boot sequence number and the name of the group is stored together in a table.

    And in some other case, the user can add a decision duplicate for related record number. (this is a new feature)

    The current logic of the procedure to add the new record on the application are

    _Get max record table with selected group name (decision_number) and the current year.

    _INSERT in the folder table the new record came with the decision to number + 1

    _ update sequence number of the number of the decision just added.

    So instead of utitlising the process of editing the built-in automatic table of the APEX, I write a procedure that combine all three processes.

    I have run some loop for continually perform this procedure, and it seems that it can generate autotically new decision unique number with time about 0.1 second difference.

    However, when I increase the number of entry to 200 and let two users run 100 each.

    If the time gap is about 0.01 second, double decision numbers are displayed.

    What can I do to prevent duplicate?

    I can't just apply a unique constraint here for three columns with condition because it can be duplicated in some special conditions. I don't know much about the use of lock and its impact.

    This is the content of my procedure

    create or replace

    PROCEDURE add_new_case)

    -ID just use the trigger

    p_case_title IN varchar2,

    p_year IN varchar2,

    p_group_name IN VARCHAR2,

    -decisionnumber here

    p_case_file_number IN VARCHAR2,

    -active

    p_user in VARCHAR2

    )

    AS

    NUMBER default_value;

    caseCount NUMBER;

    seqNumber NUMBER;

    previousDecisionNumber NUMBER;

    BEGIN

    -execution immediate q '[alter session set nls_date_format = "dd/mm/yyyy"]';

    SELECT count (*)

    IN caseCount

    OF CASE_RECORD

    WHERE GROUP_ABBR = p_group_name

    AND to_number (to_char (create_date, "yyyy")) = to_number (to_char (date_utils.get_current_date, "yyyy"));

    SELECT max (decision_number)

    IN previousDecisionNumber

    OF CASE_RECORD

    WHERE GROUP_ABBR = p_group_name

    AND to_number (to_char (create_date, "yyyy")) = to_number (to_char (date_utils.get_current_date, "yyyy"));

    IF p_group_name IS NULL

    THEN seqNumber: = 0;

    ON THE OTHER

    SELECT Seq_number INTO seqNumber FROM GROUP_LOOKUP WHERE ABBREVIATION = p_group_name;

    END IF;

    IF caseCount > 0 THEN

    default_value: largest = (seqNumber, previousdecisionnumber) + 1;

    ON THE OTHER

    default_value: = 1;

    END IF;

    INSERT INTO CASE_RECORD (case_title, decision_year, GROUP_ABBR, decision_number, case_file_number, active_yn, created_by, create_date)

    VALUES (p_case_title, p_year, p_group_name, default_value, p_case_file_number, 'Y', p_user, sysdate);

    -Need to update the sequence here also

    UPDATE GROUP_LOOKUP

    SET SEQ_NUMBER = default_value

    WHERE the ABBREVIATION = p_group_name;

    COMMIT;

    EXCEPTION

    WHILE OTHERS THEN

    Logger.Error (p_message_text = > SQLERRM)

    , p_message_code = > SQLCODE

    , p_stack_trace = > dbms_utility.format_error_backtrace

    );

    LIFT;

    END;

    Many thanks in advance,

    Ann

    It's easier to solve for the case, while p_group_name is not null. In this case, you update a GROUP_LOOKUP line, so that you can select to update this line at the beginning, to prevent cases of two for the same group added at the same time. To do this, change the selection of GROUP_LOOKUP to:

    SELECT Seq_number INTO seqNumber FROM GROUP_LOOKUP WHERE ABBREVIATION = p_group_name for an updated VERSION OF the SEQ_NUMBER;

    and move this to be the first thing that did the procedure - before it has CASE_RECORD lines.

    In the case when p_group_name is set to null, you have some object to be locked. I think the best you can do is to lock the entire table GROUP_LOOKUP:

    the table lock in exclusive mode GROUP_LOOKUP wait 100;

    The '100 expectation' means that he will wait until 100 seconds before giving up and trigger an error. in practice, that is expected to only wait a moment.

    Exclusive mode allows others to read, but not to update the table.

    UPDATES and the LOCK of the TABLE will be updates of other sessions wait for this transaction to validate. Queries from other sessions are not affected.

    The locks are released when you commit or roll back.

  • What does that mean?  ORA-32039: WITH recursive clause must have list of column aliases

    What does that mean?  If I have alias each column in the clause, I get the same error.  I noticed that if I replace this point of view abw_v_exist_mbr_alt_hierarchy , with a statement select hard-coded query works.

    ORA-32039: WITH recursive clause must have list of column aliases

    [code]

    with bridge as)

    SELECT

    AVS.pontis_bridge_id,

    AVS.super_struct_name structure_name,

    ALV.name vehicle_name,

    AVS.inv_rf inv_rating_factor,

    AVS.opr_rf opr_rating_factor,

    AVS.post_rf legal_rating_factor,

    AVS.safe_rf permit_rating_factor,

    sys_type_display. Display inv_rating_method,

    AVS.up_to_date_ind,

    AE.event_descr,

    AE.event_timestamp,

    AP.username,

    AVS.event_id,

    SYS_TYPE_IMPACT. Display sys_type_impact,

    SYS_TYPE_LANE. Display sys_type_lane

    Of

    (SELECT

    AVEMAH.pontis_bridge_id,

    AVEMAH.super_struct_name,

    ARRS.vehicle_id,

    min (ARRS.inv_rf) inv_rf,

    min (ARRS.opr_rf) opr_rf,

    min (ARRS.post_rf) post_rf,

    min (ARRS.safe_rf) safe_rf,

    ARRS.design_method_type,

    ASMAE.event_id,

    ASMAE.up_to_date_ind,

    ARRS.impact_loading_type,

    ARRS.lane_loading_type

    Abw_v_exist_mbr_alt_hierarchy AVEMAH, abw_spng_mbr_alt_events ASMAE, abw_rating_results_summary ARRS

    WHERE

    AVEMAH.bridge_id = ASMAE.bridge_id

    and ASMAE.bridge_id = ARRS.bridge_id

    and AVEMAH.struct_def_id = ASMAE.struct_def_id

    and ASMAE.struct_def_id = ARRS.struct_def_id

    and AVEMAH.super_struct_mbr_id = ASMAE.super_struct_mbr_id

    and ASMAE.super_struct_mbr_id = ARRS.super_struct_mbr_id

    and AVEMAH.super_struct_spng_mbr_alt_id = ASMAE.super_struct_spng_mbr_alt_id

    and ASMAE.super_struct_spng_mbr_alt_id = ARRS.super_struct_spng_mbr_alt_id

    and ASMAE.event_id = ARRS.event_id

    and ASMAE.results_use_type = 37601

    GROUP OF AVEMAH.pontis_bridge_id, AVEMAH.super_struct_name, ARRS.vehicle_id, ARRS.design_method_type, ASMAE.event_id, ASMAE.up_to_date_ind, ARRS.impact_loading_type, ARRS.lane_loading_type

    ) AVS.

    abw_lib_vehicle BIANCO,

    abw_event AE,

    abw_person AP,

    abw_sys_type sys_type_display,

    abw_sys_type sys_type_impact,

    abw_sys_type sys_type_lane

    WHERE AVS.event_id = AE.event_id

    AND AE.entered_by = AP.person_id

    AND AVS.vehicle_id = ALV.vehicle_id

    AND AVS.impact_loading_type = SYS_TYPE_IMPACT.sys_type

    AND AVS.lane_loading_type = SYS_TYPE_LANE.sys_type

    AND AVS.design_method_type = sys_type_display.sys_type)

    Select

    t.pontis_bridge_id BRIDGE_NAME,

    t.event_timestamp LOAD_RATING_DATE,

    MAX (CASE WHEN t.vehicle_name = 'HL-93 (US)' THEN round (t.inv_rating_factor, 2) ELSE NULL END) LOAD_RATING_HL93_INV_FACTOR,.

    MAX (CASE WHEN t.vehicle_name = 'HL-93 (US)' THEN round (t.opr_rating_factor, 2) ELSE NULL END) LOAD_RATING_HL93_OP_FACTOR,.

    Max(case when t.vehicle_name = 'H 20-44' Then trunc (t.inv_rating_factor * 36) of OTHER END NULL) H_INV_RATING_TONS,.

    Max(case when t.vehicle_name = 'H 20-44' Then trunc (t.opr_rating_factor * 36) of OTHER END NULL) H_OP_RATING_TONS,.

    Max(case when t.vehicle_name = 'HS 20-44' Then trunc (t.inv_rating_factor * 36) of OTHER END NULL) HS_INV_RATING_TONS,.

    Max(case when t.vehicle_name = 'HS 20-44' Then trunc (t.opr_rating_factor * 36) of OTHER END NULL) HS_OP_RATING_TONS,.

    Max(case when t.inv_rating_method='LRFR' Then trunc (t.inv_rating_factor * 36) of OTHER END NULL) LRFR_INV_RATING,.

    Max(case when t.opr_rating_method='LRFR' Then trunc (t.opr_rating_factor * 36) of OTHER END NULL) LRFR_OP_RATING,.

    Max(case when t.vehicle_name = 'SU4' Then Round (t.legal_rating_factor, 2) of OTHER END NULL) LOAD_RATING_SU4_LEGAL_FACTOR,.

    Max(case when t.vehicle_name = 'Type 3S2' Then Round (t.legal_rating_factor, 2) of OTHER END NULL) LOAD_RATING_3S2_LEGAL_FACTOR,.

    Max(case when t.vehicle_name = 'Type 7 divisible Load Vehicle' Then Round (t.permit_rating_factor, 2) of OTHER END NULL) LOAD_RATING_TYP7_PERM_FACTOR,.

    Max(case when t.vehicle_name = 'Type 6A divisible Load Vehicle' Then Round (t.permit_rating_factor, 2) of OTHER END NULL) LOAD_RATING_TYP6A_PERM_FACTOR,.

    MAX (CASE WHEN t.vehicle_name = 'HL-93 (US)' THEN round (t.permit_rating_factor, 2) ELSE NULL END) LOAD_RATING_HL93_PERM_FACTOR,.

    (CASE WHEN t.inv_rating_method = 1 THEN 'LFD'

    WHEN t.inv_rating_method = 'ASD' THEN 2

    WHEN t.inv_rating_method = 'LRFD' THEN 3

    WHEN t.inv_rating_method = 'LRFR' THEN 8 ELSE NULL END) LOADRATE_METHOD_ID,.

    t.UserName LOAD_RATING_SUBMITTED_BY

    Bridge t,.

    (select q.pontis_bridge_id, max (q.event_timestamp) max_et

    Bridge q

    where q.impact_loading = 'as requested.

    and q.lane_loading = 'as requested.

    Q.pontis_bridge_id group) max_event_timestamp

    where t.impact_loading = 'as requested.

    and t.lane_loading = 'as requested.

    and t.pontis_bridge_id = max_event_timestamp.pontis_bridge_id

    and t.event_timestamp = max_event_timestamp.max_et

    and t.username = 'PCAMPISI. '

    GROUP BY

    t.pontis_bridge_id,

    t.event_timestamp,

    t.UserName,

    t.inv_rating_method;

    [/ code]

    You must use the database version 11.2, right?

    ORA-32039: WITH recursive clause must have list of column aliases

    Cause: A query clause called WITH itself (recursive) but do not have a list of aliases for column specified to him.

    Action: Add a list of column alias for the WITH clause query name.

    See:

    SELECT

    Example (you add the list of columns in the "BOLD" part / underlined below):

    WITH

    reports_to_101 (emp_last, mgr_id, eid, reportLevel) AS

    (

    SELECT employe_id, last_name, manager_id reportLevel 0

    Employees

    WHERE employee_id = 101

    UNION ALL

    SELECT e.employee_id, select, e.manager_id, reportLevel + 1

    Reports_to_101 r, e employees

    WHERE r.eid = e.manager_id

    )

    SELECT mgr_id, reportLevel, emp_last and eid

    OF reports_to_101

    ORDER BY reportLevel, eid;

  • XMLTable to extract columns with conditional path does not

    Hello

    I am on 11.2.0.3 and I need to extract columns on a section of XML with conditions on, but I get "ORA-00907: lack the right parenthesis", so I think that the way I go about it is not supported or that I have somehow the wrong syntax or something.

    This is a very simplified what I'm trying to do (there could be several different entries in the < sets1 > and < sets2 > sections and they might be in different orders, is not as if I can always choose the first or the last):

    with sample_data as (select 1 id,
                                xmltype('<root>
                                           <sets1>
                                             <set1><set_name>name1</set_name><set_val>val1</set_val></set1>
                                             <set1><set_name>name2</set_name><set_val>val2</set_val></set1>
                                           </sets1>
                                           <sets2>
                                             <set2><set_name>name3</set_name><set_val>val3</set_val></set2>
                                             <set2><set_name>name4</set_name><set_val>val4</set_val></set2>
                                           </sets2>
                                         </root>') xml_doc from dual)
    select *
    from   sample_data sd,
           xmltable('<root>' passing sd.xml_doc
                    columns col1 varchar2(10) path 'sets1/set1[set_name=''name1'']/set_val',
                            col2 varchar2(10) path 'sets1/set1[set_name=''name2'']/set_val',
                            col3 varchar2(10) path 'sets2/set2[set_name=''name4'']/set_val') x;
    

    What I'm trying to get:

    COL1  COL2  COL3
    ----  ----  ----
    val1  val2  val4
    

    I know that I could separate the < set1 > and < set2 > nodes in their own xmltypes xmltable on it and then join them and make the necessary pivoting, etc., but when I try to start that against only 1000 lines, db do not love and ended my session! Therefore, I'm looking for a more elegant way to do it.

    Is there a way to do this in a XMLTABLE? Pointers are very welcome!

    It solves your problem of sample request and you get the output that show you.

     with sample_data as (select 1 id,
                                 xmltype('
                                            
                                              name1val1
                                              name2val2
                                            
                                            
                                              name3val3
                                              name4val4
                                            
                                          ') xml_doc from dual)
     select x.*  -- change
     from   sample_data sd,
            xmltable('/root' passing sd.xml_doc  -- change
                     columns col1 varchar2(10) path 'sets1/set1[set_name="name1"]/set_val',  -- change
                             col2 varchar2(10) path 'sets1/set1[set_name="name2"]/set_val',  -- change
                             col3 varchar2(10) path 'sets2/set2[set_name="name4"]/set_val') x;  -- change
    

    As you can see, I've marked the lines that I've changed.  The error you saw came to use two single quotes in the COLUMN XPath instead to use double quotes.  Then I changed the XPath expression in the XMLTable brackets as well.

    I'm confused on what the columns you really want overall, in terms of how you know which values you want, or did you mean that you want something random sets1 and sets2.

    You store the XML file in a column of XMLType SECUREFILE BINARY, right?  It seems that you made previous visits, but just double check.

  • Export (expdp) with where clause

    Hello gurus,

    I'm trying to export with where clause. I am getting error below.


    Here is my order of export.
    expdp "'/ as sysdba'" tables = USER1.TABLE1 directory=DATA_PUMP dumpfile=TABLE1.dmp logfile=TABLE1.log query= “USER1.TABLE1:where auditdate>'01-JAN-10'”
    Here is the error
    [keeth]DB1 /oracle/data_15/db1> DATA_PUMP dumpfile=TABLE1.dmp logfile=TABLE1.log query= USER1.TABLE1:where auditdate>'01-JAN-10'                    <
    
    Export: Release 11.2.0.3.0 - Production on Tue Mar 26 03:03:26 2013
    
    Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
    
    Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    Starting "SYS"."SYS_EXPORT_TABLE_03":  "/******** AS SYSDBA" tables=USER1.TABLE1 directory=DATA_PUMP dumpfile=TABLE1.dmp logfile=TABLE1.log query= USER1.TABLE1:where auditdate
    Estimate in progress using BLOCKS method...
    Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
    Total estimation using BLOCKS method: 386 MB
    Processing object type TABLE_EXPORT/TABLE/TABLE
    Processing object type TABLE_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT
    Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX
    Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
    Processing object type TABLE_EXPORT/TABLE/TRIGGER
    Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
    ORA-31693: Table data object "USER1"."TABLE1" failed to load/unload and is being skipped due to error:
    ORA-00933: SQL command not properly ended
    Master table "SYS"."SYS_EXPORT_TABLE_03" successfully loaded/unloaded
    ******************************************************************************
    Dump file set for SYS.SYS_EXPORT_TABLE_03 is:
      /oracle/data_15/db1/TABLE1.dmp
    Job "SYS"."SYS_EXPORT_TABLE_03" completed with 1 error(s) at 03:03:58
    Version
    SQL> select * from v$version;
    
    BANNER
    --------------------------------------------------------------------------------
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE    11.2.0.3.0      Production
    TNS for IBM/AIX RISC System/6000: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production

    Hello

    You must use the settings file. Another question, I see you are using 11g. Why don't you use a data pump.?
    Data pump is faster and has more features and that regular improvement imp and exp.

    You can do the following:

    sqlplus / as sysdba
    
    Create directory DPUMP_DIR3  for 'Type here your os path that you want to export to';
    

    then tap on a file:
    Touch par.txt

    In this file, type the following line the following:

    tables=schema.table_name
    dumpfile=yourdump.dmp
    DIRECTORY=DPUMP_DIR3
    logfile=Your_logfile.log
    QUERY =abs.texp:"where hiredate>'01-JAN-13' "
    

    then proceed as follows
    expdp username/password name parfile = 'par.txt'

    You will import to Oracle 11 g to 10g version should add 'version = 10' parameter in the above setting file

    BR
    Mohamed enry
    http://mohamedelazab.blogspot.com/

  • WITH the clause can be used with an insert statement?

    Hello

    Can I use a SQL with a clause of an insert

    Something like
    create table tem (l number)
    
    insert into tem
    (l)
    (with 
      t0  as 
      (Select exp_amt as t0 from exp_main)
    select t0 from t0)
    The declaration itself works fine, but it throws the following error with insert
    Error at Command Line:8 Column:17
    Error report:
    SQL Error: ORA-32034: unsupported use of WITH clause
    32034. 00000 -  "unsupported use of WITH clause"
    *Cause:    Inproper use of WITH clause because one of the following two reasons
               1. nesting of WITH clause within WITH clause not supported yet
               2. For a set query, WITH clause can't be specified for a branch.
               3. WITH clause can't sepecified within parentheses.
    *Action:   correct query and retry
    The reason why I use this format is because we strive to produce sqls to Analytics and queries are generally formed like this. So instead of change requests in bulk, I was hoping that we were able to insert it.

    Please notify

    Thank you
    Sun

    Published by: ryansun on August 14, 2012 01:59

    >
    create table tem (general number);
    table created TEM.

    insert into tem (l)
    with t0
    as
    (Select 1 as double t0)
    Select t0 t0;

    1 inserted rows.

  • Mathematical calculation with the numbering of the current page

    Hello

    I am currently in a situation where I need 2 types of page numbers for a single page.

    delete.jpg

    To the right side, I use the current page number marker.

    Is there a way to make a mathematical calculation with number of current page on the left side?

    Something like 460 + current page number

    I can't use the data merge feature because all the page are already installed on.

    Kind regards.

    Hello

    You can run a script:

    app.findGrepPreferences = null;
    app.findGrepPreferences.findWhat = "~N";
    
    var
         FindGrep=app.activeDocument.findGrep(),
         len = FindGrep.length,
         item, pageNo, calcNo, rightSide,
         mDiff = 460;          // edit this value according to needs
    
         while (len-->0) {
              item = FindGrep[len];
              pageNo = item.parentTextFrames[0].parentPage.name;
              calcNo = parseInt(pageNo) + mDiff;
              item.paragraphs[0].contents = calcNo + "\t" + pageNo;
              rightSide = item.parentTextFrames[0].textFramePreferences.textColumnFixedWidth;
              with (item.paragraphs[0]) {
                   tabStops.add({alignment: TabStopAlignment.RIGHT_ALIGN, position: rightSide});
                   justification = Justification.LEFT_ALIGN;
                   }
              }
    

    that should work assuming management texts related with the pageNumbers are substituted (accessible)

    Jarek

  • How to disable certain fields in the form of a calculation with a checkbox for the fields.

    How to disable certain fields in the form of a calculation with a checkbox for the fields.

    In Canada, we have taxes

    I create a form that allows them to calculate a total

    Shema-pdf-form.gif

    I need to be able to turn off all of those taxes to participate in the calculation and to their field visible should be 0

    I was thinking about using a check box (when the checkbox is enabled (Yes) the tax is calculated, unchecked (Off) the tax is not calculated and visible field should show 0 or anything...)

    I really need help on this one, I am a complete newbie...

    Note that the second tax is calculated on the sum of what the first tax Add (tax first is pan-Canadian tax (all provinces).

    The second tax is never only use (Quebec only (in addition to one Canadian)

    Sometimes to sell outside Canada - no tax at all is calculated...

    What should I do?

    Yes, it's just the JS...

Maybe you are looking for

  • Compensation of Apple

    My phone is not apple why pay?

  • Pavilion Elite HPE-170 t - Wi - Fi adapter with antenna?

    I would like to connect to a desktop Pavilion Elite to a local network. The router is a Linksys EA3500 (802.11n technology). The distance between the router and the wireless adapter on the desktop will be about 30 feet with walls between the two. The

  • How to open the html document

    I can't open HTML documents. I want to open them and save them as PDF or WORD documents but don't know how. I need very simple instructions. Thank you!

  • 2012 AVG Internet Security.

    I recently installed AVG 2012 Internet Security on an experimental basis and then uninstalled, but my Security Center indicates that AVG 2012 is the anti-virus program and a firewall active.  How can I solve this?  I find all the files AVG or left on

  • HP ENVY TS m6 Sleekbook: port Ethernet HP ENVY broken

    Clip of port Ethernet of my computer broke, not the hinge plastic broke.  This is the part that leans down to cut the Ethernet cable to the computer.  If I hold the cable into the Ethernet port on my computer still receives data through it.  Let me k