Need help in selecting translations for bursting

Hi,
I am using EBS 12.1.3 (XML publisher 5.6.3) .I am successfully able to burst my consolidated report to e-mail in english language. But somehow I cannot get it to select the french translation ,for which I have already uploaded the corresponding xlf file for the template. I searched the forum and tried the filter attribute,so that my control file looks like this:
<?xml version="1.0" encoding="UTF-8" ?>
<xapi:requestset xmlns:xapi="http://xmlns.oracle.com/oxp/xapi">
<xapi:request select="/DATA/LIST_G_COUNT/G_COUNT">
<xapi:delivery>
<xapi:email server="10.96.9.132" port="25" from="[email protected]" reply-to="">
<xapi:message id="123" to="[email protected]" attachment="true"
subject="${NAME} GL Voucher Report">Please find attached herewith the GL Voucher Report for ${NAME}.
</xapi:message>
</xapi:email>
</xapi:delivery>
<xapi:document output-type="excel" delivery="123">
<xapi:template type="rtf" locale="en-US" location="xdo://BTVL.XXBILCGLVCHR.en.US/?getSource=true"
filter=".//G_COUNT[LANGUAGE='FR']" translation="XXBILCGLVCHR_fr_FR.xlf" />
<xapi:template type="rtf" locale="en-US" location="xdo://BTVL.XXBILCGLVCHR.en.US/?getSource=true"
filter=".//G_COUNT[LANGUAGE='FR']" translation="XXBILCGLVCHR_fr_FR.xlf" />
</xapi:document>
</xapi:request>
</xapi:requestset>My report XML file structure is like this:
<DATA>
       <PARAMETER1>value for Parameter1</PARAMETER1>
      <PARAMETER 7>value for Parameter 7</PARAMETER7>
      <LIST_G_COUNT>
              <G_COUNT>
              <FIELD1>Value for F1</FIELD1>
              <LANGUAGE>US</LANGUAGE>
              <LIST_G_VOUCHER_NUM>
                        <G_VOUCHER_NUM>
                                <FIELD2>Value for F2</FIELD2>
                                <FIELD7>Value for F7</FIELD7>
                        </G_VOUCHER_NUM>
                        <G_VOUCHER_NUM>
                                <FIELD2>Value for F2</FIELD2>
                                <FIELD7>Value for F7</FIELD7>
                        </G_VOUCHER_NUM>
                 </LIST_G_VOUCHER_NUM>
                 <CS_SUM>Value</CS_SUM>
              </G_COUNT>
              <G_COUNT>
              </G_COUNT>
      </LIST_G_COUNT>
</DATA>Oddly though, the bursting program errors out when I try to make it select any of the 2 languages using the above control file. It gives the message :
Error while generating the Document...Any having any idea as to where i might be going wrong ?Any help will be appreciated.

Hi Sarath
Following package will help for find applied tax , charges and order total
OE_OE_TOTALS_SUMMARY.PRT_ORDER_TOTAL (OOH.header_id),
OE_OE_TOTALS_SUMMARY.Taxes (OOH.header_id),
OE_OE_TOTALS_SUMMARY.Charges (OOH.header_id)
Regards,
akil

Similar Messages

  • Need help on selection screen optation

    1)PARAMETER: P_DETAIL RADIOBUTTON GROUP G1 DEFAULT 'X'.
    2)PARAMETER: P_SUMM RADIOBUTTON GROUP G1
    3)SELECT-OPTIONS: S_PGI FOR ZAPDDLIV-ZDATE
    i have 2 parameters depending on parameter i need to accept selection screen for parameter 1 accept data in dd.mm.yyyy. and for parameter need to accept only mm.yyyy
    only
    need help on this selection criteria..

    Hi Anil,
    It is very much possible. Use Modif ID concept. First dont display any date, depending on radio button selected display date in which ever form u need.
    See the sample coding for Modif id.
    PARAMETERS: test1(10) TYPE c MODIF ID sc1,
                test2(10) TYPE c MODIF ID sc2,
                test3(10) TYPE c MODIF ID sc1,
                test4(10) TYPE c MODIF ID sc2.
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        IF screen-group1 = 'SC1'.
          screen-intensified = '1'.
          MODIFY SCREEN.
          CONTINUE.
        ENDIF.
        IF screen-group1 = 'SC2'.
          screen-intensified = '0'.
          MODIFY SCREEN.
        ENDIF.
      ENDLOOP.
    Dont forget to reward points if found useful.
    Thanks,
    Satyesh

  • Need help in developing BADI for IT0001

    Hi All,
    I need help in developing BADI for IT0001.
    On IT0001 create or change, there is need to update IT0017 with following data from IT0001
    -Company Code
    -Cost center
    -Business Area
    -Begin and End Date.
    Other fields from IT0017 need to be derived from Position and update in IT0017.
    Please guide me how I can address this. I do not want to go for dynamic action, as it is not getting evoked during background jobs.
    I am new to BADI development and will appreciate step by step instructions.
    Thanks

    Hi,
         follow the below steps to achive
    Steps:
    1.     Execute Business Add-In(BADI) transaction SE18
    2.     Enter BADI name i.e. HRPAD00INFTY and press the display
            button
    3.     Select menu option Implementation->Create
    4.     Give implementation a name such as Z_HRPAD00INFTY
    5.      You can now make any changes you require to the BADI within this
            implementation, for example choose the Interface tab there are 3 methods avialble
    6.     Double click on the method you want to change, you can now enter
            any code you require.
    7.      Please note to find out what import and export parameters a
            method has got return the original BADI definition
            (i.e. HRPAD00INFTY) and double click on the method name
            for example within HRPAD00INFTY contract is a method
    8.      When changes have been made activate the implementation
    <b>Reward points</b>
    Regards

  • I need help scrolling and highlighting for a vast amount of pics that I'm trying to transfer. I have a macbook pro osx 10.5.8

    I need help scrolling and highlighting for a vast amount of pics that I'm trying to transfer. I have a macbook pro osx 10.5.8

    I need help scrolling and highlighting for a vast amount of pics that I'm trying to transfer. I have a macbook pro osx 10.5.8

  • I still need help with the Dictionary for my Nokia...

    I still need help with the Dictionary for my Nokia 6680...
    Here's the error message I get when trying to open dictionary...
    "Dictionary word information missing. Install word database."
    Can someone please provide me a link the where I could download this dictionary for free?
    Thanks!
    DON'T HIT KIDS... THEY HAVE GUNS NOW.

    oops, im sorry, i didnt realised i've already submitted it
    DON'T HIT KIDS... THEY HAVE GUNS NOW.

  • Need help with calculator project for an assignment...

    Hi all, I please need help with my calculator project that I have to do for an assignment.
    Here is the project's specifications that I need to do"
    """Create a console calculator applicaion that:
    * Takes one command line argument: your name and surname. When the
    program starts, display the date and time with a welcome message for the
    user.
    * Display all the available options to the user. Your calculator must include
    the arithmetic operations as well as at least five scientific operations of the
    Math class.
    -Your program must also have the ability to round a number and
    truncate it.
    -When you multiply by 2, you should not use the '*' operator to perform the
    operation.
    -Your program must also be able to reverse the sign of a number.
    * Include sufficient error checking in your program to ensure that the user
    only enters valid input. Make use of the String; Character, and other
    wrapper classes to help you.
    * Your program must be able to do conversions between decimal, octal and
    hex numbers.
    * Make use of a menu. You should give the user the option to end the
    program when entering a certain option.
    * When the program exits, display a message for the user, stating the
    current time, and calculate and display how long the user used your
    program.
    * Make use of helper classes where possible.
    * Use the SDK to run your program."""
    When the program starts, it asks the user for his/her name and surname. I got the program to ask the user again and again for his/her name and surname
    when he/she doesn't insert anything or just press 'enter', but if the user enters a number for the name and surname part, the program continues.
    Now my question is this: How can I restrict the user to only enter 'letters' (and spaces of course) but allow NO numbers for his/her surname??
    Here is the programs code that I've written so far:
    {code}
    import java.io.*;
    import java.util.*;
    import java.text.*;
    public class Project {
         private static String nameSurname = "";     
         private static String num1 = null;
         private static String num2 = null;
         private static String choice1 = null;
         private static double answer = 0;
         private static String more;
         public double Add() {
              answer = (Double.parseDouble(num1) + Double.parseDouble(num2));
              return answer;
         public double Subtract() {
              answer = (Double.parseDouble(num1) - Double.parseDouble(num2));
              return answer;
         public double Multiply() {
              answer = (Double.parseDouble(num1) * Double.parseDouble(num2));
              return answer;
         public double Divide() {
              answer = (Double.parseDouble(num1) / Double.parseDouble(num2));
              return answer;
         public double Modulus() {
              answer = (Double.parseDouble(num1) % Double.parseDouble(num2));
              return answer;
         public double maximumValue() {
              answer = (Math.max(Double.parseDouble(num1), Double.parseDouble(num2)));
              return answer;
         public double minimumValue() {
              answer = (Math.min(Double.parseDouble(num1), Double.parseDouble(num2)));
              return answer;
         public double absoluteNumber1() {
              answer = (Math.abs(Double.parseDouble(num1)));
              return answer;
         public double absoluteNumber2() {
              answer = (Math.abs(Double.parseDouble(num2)));
              return answer;
         public double Squareroot1() {
              answer = (Math.sqrt(Double.parseDouble(num1)));
              return answer;
         public double Squareroot2() {
              answer = (Math.sqrt(Double.parseDouble(num2)));
              return answer;
         public static String octalEquivalent1() {
              int iNum1 = Integer.parseInt(num1);
    String octal1 = Integer.toOctalString(iNum1);
    return octal1;
         public static String octalEquivalent2() {
              int iNum2 = Integer.parseInt(num2);
              String octal2 = Integer.toOctalString(iNum2);
              return octal2;
         public static String hexadecimalEquivalent1() {
              int iNum1 = Integer.parseInt(num1);
              String hex1 = Integer.toHexString(iNum1);
              return hex1;
         public static String hexadecimalEquivalent2() {
              int iNum2 = Integer.parseInt(num2);
              String hex2 = Integer.toHexString(iNum2);
              return hex2;
         public double Round1() {
              answer = Math.round(Double.parseDouble(num1));
              return answer;
         public double Round2() {
              answer = Math.round(Double.parseDouble(num2));
              return answer;
              SimpleDateFormat format1 = new SimpleDateFormat("EEEE, dd MMMM yyyy");
         Date now = new Date();
         SimpleDateFormat format2 = new SimpleDateFormat("hh:mm a");
         static Date timeIn = new Date();
         public static long programRuntime() {
              Date timeInD = timeIn;
              long timeOutD = System.currentTimeMillis();
              long msec = timeOutD - timeInD.getTime();
              float timeHours = msec / 1000;
                   return (long) timeHours;
         DecimalFormat decimals = new DecimalFormat("#0.00");
         public String insertNameAndSurname() throws IOException{
              boolean inputCorrect = false;
                   while (inputCorrect == false) {
                        while (nameSurname == null || nameSurname.length() == 0) {
                             for (int i = 0; i < nameSurname.length(); i++) {
                             if ((nameSurname.charAt(i) > 'a') && (nameSurname.charAt(i) < 'Z')){
                                       inputCorrect = true;
                        else{
                        inputCorrect = false;
                        break;
                        try {
                             BufferedReader inStream = new BufferedReader (new InputStreamReader(System.in));
                             System.out.print("Please enter your name and surname: ");
                             nameSurname = inStream.readLine();
                             inputCorrect = true;
                        }catch (IOException ex) {
                             System.out.println("You did not enter your name and surname, " + nameSurname + " is not a name, please enter your name and surname :");
                             inputCorrect = false;
                        System.out.println("\nA warm welcome " + nameSurname + " ,todays date is: " + format1.format(now));
                        System.out.println("and the time is now exactly " + format2.format(timeIn) + ".");
                        return nameSurname;
              public String inputNumber1() throws IOException {
              boolean inputCorrect = false;
                   while (inputCorrect == false) {
                        try {
                             BufferedReader br = new BufferedReader (new InputStreamReader(System.in));
                             System.out.print("\nPlease enter a number you want to do a calculation with and hit <ENTER>: ");
                             num1 = br.readLine();
                             double number1 = Double.parseDouble(num1);
                             System.out.println("\nThe number you have entered is: " + number1);
                             inputCorrect = true;
                        } catch (NumberFormatException nfe) {
                             System.out.println("\nYou did not enter a valid number: " + "\""+ num1 + "\" is not a number!!");
                             inputCorrect = false;
                        return num1;
         public String calculatorChoice() throws IOException {
              System.out.println("Please select an option of what you would like to do with this number from the menu below and hit <ENTER>: ");
              System.out.println("\n*********************************************");
              System.out.println("---------------------------------------------");
              System.out.println("Please select an option from the list below: ");
              System.out.println("---------------------------------------------");
              System.out.println("1 - Add");
              System.out.println("2 - Subtract");
              System.out.println("3 - Multiply");
              System.out.println("4 - Divide (remainder included)");
              System.out.println("5 - Maximum and minimum value of two numbers");
              System.out.println("6 - Squareroot");
              System.out.println("7 - Absolute value of numbers");
              System.out.println("8 - Octal and Hexadecimal equivalent of numbers");
              System.out.println("9 - Round numbers");
              System.out.println("0 - Exit program");
              System.out.println("**********************************************");
              boolean inputCorrect = false;
                   while (inputCorrect == false) {
                        try {
                             BufferedReader inStream = new BufferedReader (new InputStreamReader(System.in));
                             System.out.print("Please enter your option and hit <ENTER>: ");
                             choice1 = inStream.readLine();
                             int c1 = Integer.parseInt(choice1);
                             System.out.println("\nYou have entered choice number: " + c1);
                             inputCorrect = true;
                        } catch (NumberFormatException nfe) {
                             System.out.println("You did not enter a valid choice number: " + "\""+ choice1 + "\" is not in the list!!");
                             inputCorrect = false;
                        return choice1;
         public String inputNumber2() throws IOException {
              boolean inputCorrect = false;
                   while (inputCorrect == false) {
                        try {
                             BufferedReader br2 = new BufferedReader (new InputStreamReader(System.in));
                             System.out.print("\nPlease enter another number you want to do the calculation with and hit <ENTER>: ");
                             num2 = br2.readLine();
                             double n2 = Double.parseDouble(num2);
                             System.out.println("\nThe second number you have entered is: " + n2);
                             System.out.println("\nYour numbers are: " + num1 + " and " + num2);
                             inputCorrect = true;
                        } catch (NumberFormatException nfe) {
                             System.out.println("You did not enter a valid number: " + "\""+ num2 + "\" is not a number!!");
                             inputCorrect = false;
                        return num2;
         public int Calculator() {
              int choice2 = (int) Double.parseDouble(choice1);
              switch (choice2) {
                        case 1 :
                             Add();
                             System.out.print("The answer of " + num1 + " + " + num2 + " is: " + decimals.format(answer));
                             break;
                        case 2 :
                             Subtract();
                             System.out.print("The answer of " + num1 + " - " + num2 + " is: " + decimals.format(answer));
                             break;
                        case 3 :
                             Multiply();
                             System.out.print("The answer of " + num1 + " * " + num2 + " is: " + decimals.format(answer));
                             break;
                        case 4 :
                             Divide();
                             System.out.print("The answer of " + num1 + " / " + num2 + " is: " + decimals.format(answer));
                             Modulus();
                             System.out.print(" and the remainder is " + decimals.format(answer));
                             break;
                        case 5 :
                             maximumValue();
                             System.out.println("The maximum number between the numbers " + num1 + " and " + num2 + " is: " + decimals.format(answer));
                             minimumValue();
                             System.out.println("The minimum number between the numbers " + num1 + " and " + num2 + " is: " + decimals.format(answer));
                             break;
                        case 6 :
                             Squareroot1();
                             System.out.println("The squareroot of value " + num1 + " is: " + decimals.format(answer));
                             Squareroot2();
                             System.out.println("The squareroot of value " + num2 + " is: " + decimals.format(answer));
                             break;
                        case 7 :
                             absoluteNumber1();
                             System.out.println("The absolute number of " + num1 + " is: " + decimals.format(answer));
                             absoluteNumber2();
                             System.out.println("The absolute number of " + num2 + " is: " + decimals.format(answer));
                             break;
                        case 8 :
                             octalEquivalent1();
                             System.out.println("The octal equivalent of " + num1 + " is: " + octalEquivalent1());
                             octalEquivalent2();
                             System.out.println("The octal equivalent of " + num2 + " is: " + octalEquivalent2());
                             hexadecimalEquivalent1();
                             System.out.println("\nThe hexadecimal equivalent of " + num1 + " is: " + hexadecimalEquivalent1());
                             hexadecimalEquivalent2();
                             System.out.println("The hexadecimal equivalent of " + num2 + " is: " + hexadecimalEquivalent2());
                             break;
                        case 9 :
                             Round1();
                             System.out.println("The rounded number of " + num1 + " is: " + decimals.format(answer));
                             Round2();
                             System.out.println("The rounded number of " + num2 + " is: " + decimals.format(answer));
                             break;
                        case 0 :
                             if (choice2 == 0) {
                                  System.exit(1);
                             break;
                   return choice2;
              public String anotherCalculation() throws IOException {
                   boolean inputCorrect = false;
                   while (inputCorrect == false) {
                             try {                              
                                  BufferedReader br3 = new BufferedReader (new InputStreamReader(System.in));
                                  System.out.print("\nWould you like to do another calculation? Y/N ");
                                  more = br3.readLine();
                                  String s1 = "y";
                                  String s2 = "Y";
                                  if (more.equals(s1) || more.equals(s2)) {
                                       inputCorrect = true;
                                       while (inputCorrect = true){
                                            inputNumber1();
                                            System.out.println("");
                                            calculatorChoice();
                                            System.out.println("");
                                            inputNumber2();
                                            System.out.println("");
                                            Calculator();
                                            System.out.println("");
                                            anotherCalculation();
                                            System.out.println("");
                                            inputCorrect = true;
                                  } else {
                                       System.out.println("\n" + nameSurname + " thank you for using this program, you have used this program for: " + decimals.format(programRuntime()) + " seconds");
                                       System.out.println("the program will now exit, Goodbye.");
                                       System.exit(0);
                             } catch (IOException ex){
                                  System.out.println("You did not enter a valid answer: " + "\""+ more + "\" is not in the list!!");
                                  inputCorrect = false;
              return more;
         public static void main(String[] args) throws IOException {
              Project p1 = new Project();
              p1.insertNameAndSurname();
              System.out.println("");
              p1.inputNumber1();
              System.out.println("");
              p1.calculatorChoice();
              System.out.println("");
              p1.inputNumber2();
              System.out.println("");
              p1.Calculator();
                   System.out.println("");
                   p1.anotherCalculation();
                   System.out.println("");
    {code}
    *Can you please run my code for yourself and have a look at how this program is constructed*
    *and give me ANY feedback on how I can better this code(program) or if I've done anything wrong from your point of view.*
    Your help will be much appreciated.
    Thanks in advance

    Smirre wrote:
    Now my question is this: How can I restrict the user to only enter 'letters' (and spaces of course) but allow NO numbers for his/her surname??You cannot restrict the user. It is a sad fact in programming that the worst bug always sits in front of the Computer.
    What you could do is checking the input string for numbers. If it contains numbers, just reprompt for the Name.
    AND you might want to ask yourself why the heck a calculator needs to know the users Name.

  • Need help in dynamic report for a range of year and period

    Dear all,
    I need help in creating an ALV report with dynamic columns based on the Year and period entered on the selection screen. for example if in the year we enter 2002 and period range from 10 to 12 then we should get the 3 columns display for cost(example) for period 10/2002, 11/2002 and 12/2002.
    Can anyone help me in achieving this dynamically since the user can enter the year also in intervals along with the period and data also needs to be populated in the corresponding columns.
    An example code would be of great help.
    Thanks,
    Amit

    Hi,
    Use field symbols as follows.
    TYPE-POOLS : SLIS.
    TABLES : MARC,T001W.
    DATA : BEGIN OF ITAB OCCURS 0,
           MATNR LIKE MARC-MATNR,
           END OF ITAB.
    DATA : FIELDSTAB TYPE LVC_T_FCAT,
           STAB      TYPE LVC_S_FCAT,
           T_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
           S_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
           NEW_LINE TYPE REF TO DATA,
           NEW_TABLE TYPE REF TO DATA,
           INDEX(3) TYPE C,
           STR(70),
           TEXT(6),
           CNT(1),
           TEXT1(16),
           REPID LIKE SY-REPID.
    FIELD-SYMBOLS : <FS> TYPE STANDARD TABLE,
                    <WA> TYPE ANY.
    SELECT-OPTIONS : S_WERKS FOR MARC-WERKS NO INTERVALS,
                     S_MATNR FOR MARC-MATNR NO INTERVALS.
    INITIALIZATION.
      REPID = SY-REPID.
    START-OF-SELECTION.
      SELECT * FROM MARC
               INTO CORRESPONDING FIELDS OF TABLE ITAB
               WHERE MATNR IN S_MATNR
               AND   WERKS IN S_WERKS.
      SORT ITAB BY MATNR.
      DELETE ADJACENT DUPLICATES FROM ITAB COMPARING MATNR.
      STAB-FIELDNAME = 'MATNR'.
      STAB-DATATYPE  = 'CHAR'.
      STAB-INTLEN    = '18'.
      APPEND STAB TO FIELDSTAB.
      CLEAR CNT.
      LOOP AT S_WERKS.
        CLEAR TEXT.
        CNT = CNT + 1.
        CONCATENATE  'EISLO' CNT INTO TEXT.
        STAB-FIELDNAME = TEXT.
        STAB-DATATYPE  = 'CHAR'.
        STAB-INTLEN    = '16'.
        APPEND STAB TO FIELDSTAB.
        CLEAR S_WERKS.
      ENDLOOP.
      CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
        EXPORTING
          IT_FIELDCATALOG = FIELDSTAB
        IMPORTING
          EP_TABLE        = NEW_TABLE.
      ASSIGN NEW_TABLE->* TO <FS>.
      CREATE DATA NEW_LINE LIKE LINE OF <FS>.
      ASSIGN NEW_LINE->* TO <WA>.
      PERFORM MOVE_DATA.
      CLEAR S_FIELDCAT.
      S_FIELDCAT-FIELDNAME = 'MATNR'.
      S_FIELDCAT-TABNAME = ITAB.
      S_FIELDCAT-SELTEXT_M = 'Part Number'.
      S_FIELDCAT-NO_ZERO = 'X'.
      S_FIELDCAT-DDICTXT   = 'M'.
      APPEND S_FIELDCAT TO T_FIELDCAT.
      CLEAR CNT.
      LOOP AT S_WERKS.
        CLEAR T001W.
        CNT = CNT + 1.
        SELECT SINGLE * FROM T001W WHERE WERKS = S_WERKS-LOW AND SPRAS = SY-LANGU.
        CLEAR TEXT.
        CONCATENATE 'EISLO' CNT INTO TEXT.
        S_FIELDCAT-FIELDNAME = TEXT.
        S_FIELDCAT-SELTEXT_M = T001W-NAME2.
    S_FIELDCAT-NO_ZERO = 'X'.
        S_FIELDCAT-DDICTXT   = 'M'.
        APPEND S_FIELDCAT TO T_FIELDCAT.
        CLEAR S_WERKS.
      ENDLOOP.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          IT_FIELDCAT = T_FIELDCAT[]
        TABLES
          T_OUTTAB    = <FS>.
    *&      Form  MOVE_DATA
          text
    FORM MOVE_DATA.
      LOOP AT ITAB.
        CLEAR STR.
        CONCATENATE ITAB-MATNR ' ' INTO STR SEPARATED BY SPACE.
        LOOP AT S_WERKS.
          CLEAR MARC.
          SELECT SINGLE * FROM MARC WHERE MATNR = ITAB-MATNR AND WERKS = S_WERKS-LOW.
          IF SY-SUBRC EQ 0.
            CLEAR TEXT1.
            TEXT1 = MARC-EISLO.
            CONCATENATE STR TEXT1 INTO STR SEPARATED BY SPACE.
          ELSE.
            CONCATENATE STR '0' INTO STR SEPARATED BY SPACE.
          ENDIF.
        ENDLOOP.
        <WA> = STR.
        APPEND <WA> TO <FS>.
        CLEAR ITAB.
      ENDLOOP.
    ENDFORM.                    "MOVE_DATA
    Reward points if helpful.
    Regards,
    Sankar..

  • Need help [JS]: select images/captions in InD, switch to Bridge and write to XMP

    I've got a javascript for CS3/Tiger that I'm writing that eventually will let a user select an image and a caption in InDesign, then tells bridge to write the caption data into the image metadata. I need help - the script works in pieces, but not when put together.
    It's built as an indesign script, then follows the procedure to create a script object to send to bridge. When it runs, the indesign portion works fine, but nothing happens in bridge.
    The script is below, with comments.
    Can someone help!? Thanks.
    // This is the InDesign portion of the script, which was tested separately and is working fine. Right now, for testing purposes, the data from this portion isn't even used by the later Bridge portion but once I get the bridge part together, it will use those variables.
    #target "indesign-5.0"
    var myObjectList = new Array;
    //Script does nothing if no documents are open or if no objects are selected.
    if(app.documents.length != 0){
    if(app.selection.length != 0){
    for(myCounter = 0; myCounter < app.selection.length; myCounter ++){
    switch(app.selection[myCounter].constructor.name){
    case "TextFrame":
    var myCaption = app.selection[myCounter].contents;
    $.writeln(myCaption);
    break;
    default:
    var myLink = app.selection[myCounter].graphics[0].itemLink.filePath;
    $.writeln(myLink);
    // here's where I create the string of the script to send to Bridge.
    // the script itself is almost completely a lifted from the SnpModifyMetadta sample from the Bridge sdk
    // it basically finds a certain image file and modifies the description metatata. i hardcoded the caption text and image path just for testing- eventually i would like it to use the variables from indesign.
    // this script works fine as-is when run in the original Bridge scripting context.
    // the method here of concatenating and sending the myScript string works fine when i use a different (smaller) script. so i can't tell why it's not working!?
    var myScript = "function SnpModifyMetadata()";
    myScript += "{";
    myScript += " this.requiredContext = \"Needs to run in Bridge, \nwith a selection of a file, \nideally with some metadata\";";
    myScript += "}";
    myScript += "SnpModifyMetadata.prototype.run = function()";
    myScript += "{";
    myScript += " if(!this.canRun())";
    myScript += " {";
    myScript += " return false;";
    myScript += " }";
    myScript += " if( xmpLib == undefined )";
    myScript += " {";
    myScript += " if( Folder.fs == \"Windows\" )";
    myScript += " {";
    myScript += " var pathToLib = Folder.startup.fsName + \"/AdobeXMPScript.dll\";";
    myScript += " }";
    myScript += " else";
    myScript += " {";
    myScript += " var pathToLib = Folder.startup.fsName + \"/AdobeXMPScript.framework\";";
    myScript += " }";
    myScript += " var libfile = new File( pathToLib );";
    myScript += " var xmpLib = new ExternalObject(\"lib:\" + pathToLib );";
    myScript += " }";
    myScript += " $.writeln(\"About to run SnpModifyXML\");";
    myScript += " var thumb = new Thumbnail(Folder(\"/Macintosh HD/Users/hearstuser/Desktop/BridgeScriptImages/orion_stack copy 6.psd\"));";
    myScript += " if(thumb.hasMetadata)";
    myScript += " {";
    myScript += " var md = thumb.synchronousMetadata;";
    myScript += " var xmp = new XMPMeta(md.serialize());";
    myScript += " $.writeln(\"SnpModifyXML: About to modify XMP data for \" + thumb.name);";
    myScript += " $.writeln(\"XMP packet before modifications:\");";
    myScript += " $.writeln(\"-------------------------------------------------\");";
    myScript += " $.writeln(xmp.dumpObject());";
    myScript += " xmp.deleteProperty(XMPConst.NS_XMP, \"Description\");";
    myScript += " xmp.setProperty(XMPConst.NS_XMP, \"Description\", \"hoThereHeyThere\");";
    myScript += " var d = new XMPDateTime(new Date());";
    myScript += " d.convertToLocalTime();";
    myScript += " xmp.setProperty(XMPConst.NS_XMP, \"ModifyDate\", d, XMPConst.XMPDATE);";
    myScript += " $.writeln(\"XMP packet af

    Recently I received an e-mail from a user asking me to remake the script I had posted here a while ago.
    I rechecked my previous post and found a couple of serious mistakes. So I revised it according to what he asked. Each page in his InDesign document contains one image and one text frame with description.
    At start the script checks the selection. If nothing is selected it processes all pages in the document. In case two objects are selected – it checks whether one of them text frame and the other a rectangle and if the rectangle contains an image, then it reads the contents of the text frame, replacing hard and soft returns with spaces and writes this text to the corresponding image’s description field.
    In the end, it updates all links and saves the file.
    The script works both on Mac and PC, assuming that CS3 installed in the default location so long as it depends on libraries:
    /C/Program Files/Adobe/Adobe Bridge CS3/AdobeXMPScript.dll (on PC)
    /Applications/Adobe Bridge CS3/Bridge CS3.app/Contents/MacOS/AdobeXMPScript.framework (on MAC)
    So, if necessary, correct these lines.
    Here is my script in case somebody is interested:
    #target indesign
    var myDoc = app.activeDocument;
    var mySelection = app.selection;
    if (mySelection.length == 0) {
        ProcessPages();
    else if (mySelection.length == 1) {
        alert("One image and one textframe should be selected.");
        exit();   
    else if (mySelection.length == 2) {
        try {
            if (mySelection[0].constructor.name == "TextFrame" && mySelection[1].images.length == 1) {
                var myTextFrame = mySelection[0];
                var myImage = mySelection[1].images[0];
                var myCaption = ReplaceReturnWithSpace(myTextFrame.contents);
                var myPath = new File(myImage.itemLink.filePath).absoluteURI;
            else if (mySelection[1].constructor.name == "TextFrame" && mySelection[0].images.length == 1) {
                var myTextFrame = mySelection[1];
                var myImage = mySelection[0].images[0];
                var myCaption = ReplaceReturnWithSpace(myTextFrame.contents);
                var myPath = new File(myImage.itemLink.filePath).absoluteURI;
        catch(e) {
            alert("Something wrong with your selection.\nError: " + e.message);
            exit();
        CreateBridgeTalkMessage(myCaption, myPath);
    else if (mySelection.length > 2) {
        alert("One image and one textframe should be selected.");
        exit();
    UpdateAllOutdatedLinks();
    myDoc.save();
    alert("All done.");
    //+++++++++++++++++++ FUNCTIONS ++++++++++++++++++++++
    function CreateBridgeTalkMessage(myCaption, myPath) {
        var bt = new BridgeTalk();
        bt.target = "bridge";
        var myScript = WriteCaption.toString() + '\r';
        myScript += 'WriteCaption(\"' + myCaption + '\", \"' + myPath + '\");';
        bt.body = myScript;
        bt.send();
    function WriteCaption(myCaption, myPath) {
        if( xmpLib == undefined ) {
            if( Folder.fs == "Windows") {
                var pathToLib = "/C/Program Files/Adobe/Adobe Bridge CS3/AdobeXMPScript.dll";
            else {
                var pathToLib = "/Applications/Adobe Bridge CS3/Bridge CS3.app/Contents/MacOS/AdobeXMPScript.framework";
            var libfile = new File( pathToLib );
            var xmpLib = new ExternalObject("lib:" + pathToLib );
        var thumb = new Thumbnail (File (myPath));
        if (thumb.hasMetadata) {
            var md = thumb.synchronousMetadata;
            var xmp = new XMPMeta(md.serialize());
            xmp.deleteProperty(XMPConst.NS_XMP, "Description");
            xmp.setProperty(XMPConst.NS_XMP, "Description", myCaption);
            var updatedPacket = xmp.serialize(XMPConst.SERIALIZE_OMIT_PACKET_WRAPPER | XMPConst.SERIALIZE_USE_COMPACT_FORMAT);
            thumb.metadata = new Metadata(updatedPacket);
    function ProcessPages() {
        var myPages = myDoc.pages;
        for (i = 0; i < myPages.length; i++) {
            var myPage = myPages[i];
            if (myPage.textFrames.length == 1 && myPage.rectangles.length == 1) {
                if (myPage.rectangles[0].graphics.length == 1) {
                var a = myPage.rectangles[0];
                    var myImage = myPage.rectangles[0].graphics[0];
                    var myPath = new File(myImage.itemLink.filePath).absoluteURI;
                    var myTextFrame = myPage.textFrames[0];
                    var myCaption = ReplaceReturnWithSpace(myTextFrame.contents);
                    CreateBridgeTalkMessage(myCaption, myPath);
    function ReplaceReturnWithSpace(myString) {
        myString = myString.replace( /\n/g , " " );
        myString = myString.replace( /\r/g , " " );
        return myString;
    function UpdateAllOutdatedLinks() {
        for(var myCounter = myDoc.links.length-1; myCounter >= 0; myCounter--){
            var myLink = myDoc.links[myCounter];
            if (myLink.status == LinkStatus.linkOutOfDate){
                myLink.update();
    If somebody interested in developing this script further, do not hesitate to post here your feedback.
    Kasyan

  • Need help with select within select - daterange

    I use Crystal Reports v12.3.0.601 - I am a beginner.
    Problem:
    TABLE: ACCOUNTBILLFEE
    Columns are   
    FOLDERRSN
    STAMPDATE
    BILLNUMBER
    PAYMENTAMOUNT
    There are over 500,000 rows/ records...
    And I need to report the FOLDERRSN which has at least one {ACCOUNTBILLFEE.STAMPDATE} in DateTime
    (2014, 05, 01, 00, 00, 01) to DateTime (2014, 05, 31, 23, 59, 59)
    Out-put required is:
    FOLDERSN | STAMPDATE | BILLNUMBER   | PAYMENTAMOUNT
    Group by FOLDERRSN
    1010234               May01,2014                 1111                      25000
                                  May25, 2014                1112                       5000
                                  Jan 05, 2013                  998                          500
    1034567                May5, 2014                11325                       5000
    1033999                May15, 2014               6752                       15000
                                  Dec5 , 2011                1132                       25000
    Please help -
    The critical part for me, is to display  payments not within the date range in 'select expert' statement.
    Currenlty my report reflects only payments for FOLDERRSN, where {ACCOUNTBILLFEE.STAMPDATE} in DateTime
    (2014, 05, 01, 00, 00, 01) to DateTime (2014, 05, 31, 23, 59, 59) and not other payments outside the date range specified.
    Thank you for your time.

    Hi Abilash,
    This worked !!!
    My brother helped me with it here....ofcourse you have intiated the intial idea.
    It worked when i used the following SQL at 'Add Command'
    Select * from DATABASE_NAME.ACCOUNTBILLFEE A
    Where A.FOLDERSN = any ( select B.FOLDERSN from DATABASE_NAME.ACCOUNTBILLFEE B
    where B.STAMPDATE >= TO_DATE('20140501', 'YYYYMMDD')
    AND  B.STAMPDATE <= TO_DATE('20140531', 'YYYYMMDD'))
    Excellent support - Thank you so much for your immediate attention and response.
    I know, how hard it is to understand someones requirement and suggest solutions.
    You are the best and most helpful I have ever come across in my life.
    Thank you for your kind heart and extending help to me.
    Regs,
    Sridhar Lam

  • Need help regarding SELECT statement

    Hello, first time here but need help badly.
    I been using SQL syntax with another SQL server by the following statement doesnt seem to work in Oracle database.
    SELECT firstname+" "+lastname AS fullname FROM customers
    basicially, I just want to display date from two column as one column.
    Thanks

    Oracle has pipe sign for concate
    SELECT firstname||' '||lastname AS fullname
    FROM customers;Khurram

  • Need help on SQL Statement for UDF

    Hi,
    as I am not so familiar with SQL statements on currently selected values, I urgently need help.
    The scenario looks as follows:
    I have defined two UDFs named Subgroup1 and Subgroup2 which represent the subgroups dependent on my article groups. So for example: When the user selects article group "pianos", he only sees the specific subgroups like "new pianos" and "used pianos" in field "Subgroup1". After he has selected one of these specific values, he sees only the specific sub-subgroups in field "Subgroup2", like "used grand pianos".
    I have defined UDTs for both UDFs. The UDT for field "Subgroup1" has a UDF called "ArticleGroup" which represents the relation to the article group codes. The UDT for field "Subgroup2" has a UDF called "Subgroup1" which represents the relation to the subgroups one level higher.
    The SQL statement for the formatted search in field "Subgroup1" looks as follows:
    SELECT T0.[Name] FROM [dbo].[@B_SUBGROUP1]  T0 WHERE T0.[U_ArticleGroup]  = (SELECT $[OITM.ItmsGrpCod])
    It works fine.
    However, I cannot find the right statement for the formatted search in field "Subgroup2".
    Unfortunately this does NOT WORK:
    SELECT T0.[Name] FROM [dbo].[@B_SUBGROUP2]  T0 WHERE T0.[U_Subgroup1]  = (SELECT $[OITM.U_Subgroup1])
    I tried a lot of others that didn't work either.
    Then I tried the following one:
    SELECT T0.[Name] FROM [dbo].[@B_SUBGROUP2]  T0 WHERE T0.[U_Subgroup1] = (SELECT T1.[Code] FROM [dbo].[@B_SUBGROUP1] T1 WHERE T1.[U_ArticleGroup] = (SELECT $[OITM.ItmsGrpCod]))
    Unfortunately that only works as long as there is only one specific subgroup1 for the selected article group.
    I would be sooooo happy if there is anyone who can tell me the correct statement for my second UDF!
    Thanks so much in advance!!!!
    Edited by: Corinna Hochheim on Jan 18, 2010 10:16 PM
    Please ignore the "http://" in the above statements - it is certainly not part of my SQL.
    Please also ignore the strikes.

    Hello Dear,
    Use the below queries to get the values:
    Item Sub Group on the basis of Item Group
    SELECT T0.[Name] FROM [dbo].[@SUBGROUP]  T0 WHERE T0.[U_GroupCod] =$[OITM.ItmsGrpCod]
    Item Sub Group 1 on the basis of item sub group
    SELECT T0.[Name] FROM [dbo].[@SUBGROUP1]  T0 WHERE T0.[U_SubGrpCod]=(SELECT T0.[Code] FROM [dbo].[@SUBGROUP]  T0 WHERE T0.[Name] =$[OITM.U_ItmsSubgrp])
    Sub group 2 on the basis of sub group 1
    SELECT T0.[Name] FROM [dbo].[@SUBGROUP2]  T0 WHERE T0.[U_SubGrpCod1]=(SELECT T0.[Code] FROM [dbo].[@SUBGROUP1]  T0 WHERE T0.[Name] =$[OITM.U_ItmsSubgrp1])
    this will help you.
    regards,
    Neetu

  • Need help with SQL retrieval for previous month till current date

    Hi ,
    Need help generating statistics from previous month from date of enquiry till current date of enquiry.
    and have to display it according to date.
    Date of enquiry : 03/02/2012
    Application Type| 01/01/2012 | 02/01/2012 | 03/01/2012 |...... | 31/01/2012 | 01/02/2012 | 02/02/2012 | 03/02/2012 |
    sample1 20 30 40
    sample 2 40 40 50
    sample 3 50 30 30
    Hope you guys can help me with this.
    Regards

    Hi,
    932472 wrote:
    Scenario
    1)If i run the query at 12 pm on 03/2/2012. the result i will have to display till the current day.
    2)displaying the count of the application made based on the date.
    Application type 01012012 | 02012012 | 03012012 | ..... 01022012| 02022012|03022012
    sample 1 30 40 50 44 30
    sample 2 35 45 55
    sample 3 36 45 55Explain how you get those results from the sample data you posted.
    It would help a lot if you posted the results in \ tags, as described in the forum FAQ. {message{id=9360002}
    SELECT     application_type as Application_type
    ,     COUNT (CASE WHEN created_dt = sysdate-3 THEN 1 END)     AS 01012012 (should be getting dynamically)
    ,     COUNT (CASE WHEN created_dt = sysdate-4 THEN 1 END)     AS 02022012
    ,     COUNT (CASE WHEN created_dt = sysdate-5 THEN 1 END)     AS 03022012
    , COUNT (CASE WHEN created_dt = sysdate-6 THEN 1 END)     AS 04022012
    FROM     table_1
    GROUP BY application_type
    ORDER BY     application_typeThat's the bais idea.
    You can simplify it a little by factoring out the date differences:WITH got_d     AS
         SELECT     qty
         ,     TRUNC ( dt
              - ADD_MONTHS ( TRUNC (SYSDATE, 'MON')
                        , -1
              ) AS d
         FROM table1
         WHERE     dt     >= ADD_MONTHS ( TRUNC (SYSDATE, 'MON')
                        , -1
         AND dt     < TRUNC (SYSDATE) + 1
    SELECT     SUM (CASE WHEN d = 1 THEN qty END)     AS day_1
    ,     SUM (CASE WHEN d = 2 THEN qty END)     AS day_2
    ,     SUM (CASE WHEN d = 62 THEN qty END)     AS day_62
    FROM     got_d
    See the links I mentioned earlier for getting exactly the right number of columns, and dynamic column aliases.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Need help about roll ups for average that contains logic

    --Hi everyone,
    --I have posted this one on the forum before.
    (how to do outer join select query for an APEX report )--I thought it works fine, but then yesterday, the tester check and said that the Average total is not correct
    --the query is as below
    DEFINE startmonth = "Aug 2012";
    DEFINE endmonth   = "Oct 2012";
    WITH  all_months  AS
       SELECT ADD_MONTHS(to_date('&startmonth','MON YYYY'), ROWNUM-1) AS which_month
       ,      ADD_MONTHS(to_date('&startmonth','MON YYYY'), ROWNUM  ) AS next_month
       from all_objects
       where
       rownum <= months_between(to_date('&endmonth','MON YYYY'), add_months(to_date('&startmonth','MON YYYY'), -1))
    SELECT     ph.phase_number 
          ,TO_CHAR (am.which_month, 'Mon YYYY')  AS month
         , NVL(sum ( (CASE
                     WHEN ph.date_finished IS NULL OR ph.date_finished > last_day(am.which_month)
                     THEN last_day(am.which_month)
                     ELSE ph.date_finished
                  END
                 ) - ph.date_started + 1
               ) / count(def.def_id), 0) as avg_days
      FROM all_months am
           LEFT OUTER JOIN  a_phase_membership  ph  PARTITION BY (ph.phase_number)
              ON  am.which_month <= ph.date_started
              AND am.next_month  >  ph.date_started
              AND ph.date_started <= last_day(am.which_month)  -- May not be needed
              AND ph.active = 1
           LEFT OUTER JOIN  a_engagement  ce 
              ON  ph.mpm_eng_id = ce.engagement_id
              AND ce.court_name IS NOT NULL  -- or something involving LIKE
           LEFT OUTER join  a_defendant     def
              ON  ce.defendant_id = def.def_id
              AND def.active = 1
    GROUP BY ROLLUP(phase_number,  am.which_month)
    ORDER BY  ph.phase_number, am.which_month
    --result is
    PHASE_NUMBER                                       MONTH             AVG_DAYS              
    PHASE ONE                                          Aug 2012          0                     
    PHASE ONE                                          Sep 2012          12                    
    PHASE ONE                                          Oct 2012          8                     
    PHASE ONE                                                            11                    
    PHASE THREE                                        Aug 2012          0                     
    PHASE THREE                                        Sep 2012          1                     
    PHASE THREE                                        Oct 2012          0                     
    PHASE THREE                                                          1                     
    PHASE TWO                                          Aug 2012          0                     
    PHASE TWO                                          Sep 2012          9                     
    PHASE TWO                                          Oct 2012          14                    
    PHASE TWO                                                            11.5                  
                                                                         9.71428571428571428571428571428571428571
    --And the tester is right, AVG days for phase one should be (12+8) /3 = 6.67 not 11, the same with phase two and three.
    -- I tried to put a union select below the above which wrap it and do the average, but found that this select is too long and cumbersome.
    --I have to ask for the Forum expert again, is there any way to make it look like
    PHASE_NUMBER                                       MONTH             AVG_DAYS              
    PHASE ONE                                          Aug 2012          0                     
    PHASE ONE                                          Sep 2012          12                    
    PHASE ONE                                          Oct 2012          8                     
    PHASE ONE                                                            6.67                  
    PHASE THREE                                        Aug 2012          0                     
    PHASE THREE                                        Sep 2012          1                     
    PHASE THREE                                        Oct 2012          0                     
    PHASE THREE                                                          0.33                     
    PHASE TWO                                          Aug 2012          0                     
    PHASE TWO                                          Sep 2012          9                     
    PHASE TWO                                          Oct 2012          14                    
    PHASE TWO                                                            7.66                  
                                                                         4.896... (average of Phase one, phase two, and phase three)                                                                      --Here is the sample data structure (Database version is 11g)
    CREATE TABLE "A_DEFENDANT"
        "DEF_ID"     NUMBER NOT NULL ENABLE,
        "FIRST_NAME" VARCHAR2(50 BYTE),
        "SURNAME"    VARCHAR2(20 BYTE) NOT NULL ENABLE,
        "DOB" DATE NOT NULL ENABLE,
        "ACTIVE" NUMBER(2,0) DEFAULT 1 NOT NULL ENABLE,
        CONSTRAINT "A_DEFENDANT_PK" PRIMARY KEY ("DEF_ID"));
    Sample Data
    Insert into A_DEFENDANT (DEF_ID,FIRST_NAME,SURNAME,DOB,ACTIVE) values (101,'Joe','Bloggs',to_date('12/12/99','DD/MM/RR'),1);
    Insert into A_DEFENDANT (DEF_ID,FIRST_NAME,SURNAME,DOB,ACTIVE) values (102,'John','Smith',to_date('20/05/00','DD/MM/RR'),1);
    Insert into A_DEFENDANT (DEF_ID,FIRST_NAME,SURNAME,DOB,ACTIVE) values (103,'Jane','Black',to_date('15/02/98','DD/MM/RR'),1);
    Insert into A_DEFENDANT (DEF_ID,FIRST_NAME,SURNAME,DOB,ACTIVE) values (104,'Minnie','Mouse',to_date('13/12/88','DD/MM/RR'),0);
    Insert into A_DEFENDANT (DEF_ID,FIRST_NAME,SURNAME,DOB,ACTIVE) values (105,'Daisy','Duck',to_date('05/08/00','DD/MM/RR'),1);
    CREATE TABLE "A_ENGAGEMENT"
        "ENGAGEMENT_ID" NUMBER NOT NULL ENABLE,
        "COURT_NAME"    VARCHAR2(50 BYTE) NOT NULL ENABLE,
        "DATE_REFERRED" DATE,
        "DETERMINATION_HEARING_DATE" DATE,
        "DATE_JOINED_COURT" DATE,
        "DATE_TREATMENT_STARTED" DATE,
        "DATE_TERMINATED" DATE,
        "TERMINATION_TYPE" VARCHAR2(50 BYTE),
        "ACTIVE"           NUMBER(2,0) DEFAULT 1 NOT NULL ENABLE,
        "DEFENDANT_ID"     NUMBER,
        CONSTRAINT "A_ENGAGEMENT_PK" PRIMARY KEY ("ENGAGEMENT_ID"));
    Insert into A_ENGAGEMENT (ENGAGEMENT_ID,COURT_NAME,DATE_REFERRED,DETERMINATION_HEARING_DATE,DATE_JOINED_COURT,DATE_TREATMENT_STARTED,DATE_TERMINATED,TERMINATION_TYPE,ACTIVE,DEFENDANT_ID) values (1,'AA',to_date('12/08/12','DD/MM/RR'),null,to_date('12/08/12','DD/MM/RR'),null,null,null,1,101);
    Insert into A_ENGAGEMENT (ENGAGEMENT_ID,COURT_NAME,DATE_REFERRED,DETERMINATION_HEARING_DATE,DATE_JOINED_COURT,DATE_TREATMENT_STARTED,DATE_TERMINATED,TERMINATION_TYPE,ACTIVE,DEFENDANT_ID) values (2,'BB',to_date('01/09/12','DD/MM/RR'),null,to_date('02/09/12','DD/MM/RR'),null,null,null,1,102);
    Insert into A_ENGAGEMENT (ENGAGEMENT_ID,COURT_NAME,DATE_REFERRED,DETERMINATION_HEARING_DATE,DATE_JOINED_COURT,DATE_TREATMENT_STARTED,DATE_TERMINATED,TERMINATION_TYPE,ACTIVE,DEFENDANT_ID) values (3,'AA',to_date('02/09/12','DD/MM/RR'),null,to_date('15/09/12','DD/MM/RR'),null,null,null,1,103);
    Insert into A_ENGAGEMENT (ENGAGEMENT_ID,COURT_NAME,DATE_REFERRED,DETERMINATION_HEARING_DATE,DATE_JOINED_COURT,DATE_TREATMENT_STARTED,DATE_TERMINATED,TERMINATION_TYPE,ACTIVE,DEFENDANT_ID) values (4,'BB',to_date('01/10/12','DD/MM/RR'),null,to_date('02/10/12','DD/MM/RR'),null,null,null,1,105);
    CREATE TABLE "A_PHASE_MEMBERSHIP"
        "MPM_ID"       NUMBER NOT NULL ENABLE,
        "MPM_ENG_ID"   NUMBER NOT NULL ENABLE,
        "PHASE_NUMBER" VARCHAR2(50 BYTE),
        "DATE_STARTED" DATE NOT NULL ENABLE,
        "DATE_FINISHED" DATE,
        "NOTES"  VARCHAR2(2000 BYTE),
        "ACTIVE" NUMBER(2,0) DEFAULT 1 NOT NULL ENABLE,
        CONSTRAINT "A_PHASE_MEMBERSHIP_PK" PRIMARY KEY ("MPM_ID"));
    Insert into A_PHASE_MEMBERSHIP (MPM_ID,MPM_ENG_ID,PHASE_NUMBER,DATE_STARTED,DATE_FINISHED,NOTES,ACTIVE) values (1,1,'PHASE ONE',to_date('15/09/12','DD/MM/RR'),to_date('20/09/12','DD/MM/RR'),null,1);
    Insert into A_PHASE_MEMBERSHIP (MPM_ID,MPM_ENG_ID,PHASE_NUMBER,DATE_STARTED,DATE_FINISHED,NOTES,ACTIVE) values (2,1,'PHASE TWO',to_date('21/09/12','DD/MM/RR'),to_date('29/09/12','DD/MM/RR'),null,1);
    Insert into A_PHASE_MEMBERSHIP (MPM_ID,MPM_ENG_ID,PHASE_NUMBER,DATE_STARTED,DATE_FINISHED,NOTES,ACTIVE) values (3,2,'PHASE ONE',to_date('12/09/12','DD/MM/RR'),null,null,1);
    Insert into A_PHASE_MEMBERSHIP (MPM_ID,MPM_ENG_ID,PHASE_NUMBER,DATE_STARTED,DATE_FINISHED,NOTES,ACTIVE) values (4,3,'PHASE ONE',to_date('20/09/12','DD/MM/RR'),to_date('01/10/12','DD/MM/RR'),null,1);
    Insert into A_PHASE_MEMBERSHIP (MPM_ID,MPM_ENG_ID,PHASE_NUMBER,DATE_STARTED,DATE_FINISHED,NOTES,ACTIVE) values (5,3,'PHASE TWO',to_date('02/10/12','DD/MM/RR'),to_date('15/10/12','DD/MM/RR'),null,1);
    Insert into A_PHASE_MEMBERSHIP (MPM_ID,MPM_ENG_ID,PHASE_NUMBER,DATE_STARTED,DATE_FINISHED,NOTES,ACTIVE) values (6,4,'PHASE ONE',to_date('03/10/12','DD/MM/RR'),to_date('10/10/12','DD/MM/RR'),null,1);
    Insert into A_PHASE_MEMBERSHIP (MPM_ID,MPM_ENG_ID,PHASE_NUMBER,DATE_STARTED,DATE_FINISHED,NOTES,ACTIVE) values (7,3,'PHASE THREE',to_date('17/10/12','DD/MM/RR'),null,null,0);
    Insert into A_PHASE_MEMBERSHIP (MPM_ID,MPM_ENG_ID,PHASE_NUMBER,DATE_STARTED,DATE_FINISHED,NOTES,ACTIVE) values (8,1,'PHASE THREE',to_date('30/09/12','DD/MM/RR'),to_date('16/10/12','DD/MM/RR'),null,1);--Probably after this crazy  project (reason: BA cannot make up her minds, and keep changing requirements about the reports, and then business want it done asap),
    -- I need to buy a book and spend a lot of time to learn more about Oracle SQL Analytical function and Aggregation.
    --Thanks a lot again, guys.
    Ann

    --Thanks  Jeneesh
    --However, this time I found another bug relating filter the figures by court_name
    DEFINE startmonth = "Aug 2012";
    DEFINE endmonth   = "Oct 2012";
    WITH  all_months_pre  AS
       SELECT ADD_MONTHS(to_date('&startmonth','MON YYYY'), ROWNUM-1) AS which_month
       ,      ADD_MONTHS(to_date('&startmonth','MON YYYY'), ROWNUM  ) AS next_month
       from all_objects
       where
       rownum <= months_between(to_date('&endmonth','MON YYYY'), add_months(to_date('&startmonth','MON YYYY'), -1))
    all_months as
      select phase_number,which_month,next_month
      from all_months_pre,(select distinct phase_number from a_phase_membership)
    total_data as
    SELECT am.phase_number,
           TO_CHAR (am.which_month, 'Mon YYYY')  AS month,
           nvl((CASE
                     WHEN ph.date_finished IS NULL OR ph.date_finished > last_day(am.which_month)
                     THEN last_day(am.which_month)
                     ELSE ph.date_finished
                  END
                 ) - ph.date_started + 1,0) days,def_id
      FROM all_months am
           LEFT OUTER JOIN  a_phase_membership  ph  --PARTITION BY (ph.phase_number)
              ON  am.phase_number = ph.phase_number
                --I have found out that the Requirement don't need these, so I comment it out
              --and am.which_month <= ph.date_started
              --AND am.next_month  >  ph.date_started
              AND ph.date_started <= last_day(am.which_month)
              AND ph.active = 1
           LEFT JOIN  a_engagement  ce 
              ON  ph.mpm_eng_id = ce.engagement_id
              AND ce.court_name LIKE 'BB' 
           LEFT OUTER join  a_defendant     def
              ON  ce.defendant_id = def.def_id
              AND def.active = 1
    avg_data as
        select phase_number,month,avg(days) avg_days
        from total_data
        group by phase_number,month
    select phase_number,month,round(avg(avg_days),2) avg_days
    from avg_data
    group by rollup(phase_number,month)
    order by 1
    ;--I run the  select for
    AND court_name like 'BB'
    --then run for
    AND court_name LIKE 'AA'
    or court_name LIKE '%'--They all return the same result which is
    PHASE_NUMBER                                       MONTH             AVG_DAYS              
    PHASE ONE                                          Aug 2012          0                     
    PHASE ONE                                          Oct 2012          12.67                 
    PHASE ONE                                          Sep 2012          7.2                   
    PHASE ONE                                                            6.62                  
    PHASE THREE                                        Aug 2012          0                     
    PHASE THREE                                        Oct 2012          5.67                  
    PHASE THREE                                        Sep 2012          0.33                  
    PHASE THREE                                                          2                     
    PHASE TWO                                          Aug 2012          0                     
    PHASE TWO                                          Oct 2012          5.75                  
    PHASE TWO                                          Sep 2012          3                     
    PHASE TWO                                                            2.92                  
                                                                         3.85                  
    13 rows selected --If I adjust the statement to
    WITH  all_months_pre  AS
       SELECT ADD_MONTHS(to_date('&startmonth','MON YYYY'), ROWNUM-1) AS which_month
       ,      ADD_MONTHS(to_date('&startmonth','MON YYYY'), ROWNUM  ) AS next_month
       from all_objects
       where
       rownum <= months_between(to_date('&endmonth','MON YYYY'), add_months(to_date('&startmonth','MON YYYY'), -1))
    all_months as
      select phase_number,which_month,next_month
      from all_months_pre,(select distinct phase_number from a_phase_membership)
    total_data as
    SELECT am.phase_number,
           TO_CHAR (am.which_month, 'Mon YYYY')  AS month,
           nvl((CASE
                     WHEN ph.date_finished IS NULL OR ph.date_finished > last_day(am.which_month)
                     THEN last_day(am.which_month)
                     ELSE ph.date_finished
                  END
                 ) - ph.date_started + 1,0) days,def_id
      FROM all_months am
           LEFT OUTER JOIN  a_phase_membership  ph  --PARTITION BY (ph.phase_number)
              ON  am.phase_number = ph.phase_number
              AND ph.date_started <= last_day(am.which_month)
              AND ph.active = 1
           INNER JOIN  a_engagement  ce 
              ON  ph.mpm_eng_id = ce.engagement_id
              AND ce.court_name LIKE 'BB' 
           LEFT OUTER join  a_defendant     def
              ON  ce.defendant_id = def.def_id
              AND def.active = 1
    avg_data as
        select phase_number,month,avg(days) avg_days
        from total_data
        group by phase_number,month
    select phase_number,month,round(avg(avg_days),2) avg_days
    from avg_data
    group by rollup(phase_number,month)
    order by 1;--The result will be
    PHASE_NUMBER                                       MONTH             AVG_DAYS              
    PHASE ONE                                          Oct 2012          29                    
    PHASE ONE                                          Sep 2012          19                    
    PHASE ONE                                                            24                    
                                                                         24     --AND IF COURT_NAME = 'AA'
    PHASE_NUMBER                                       MONTH             AVG_DAYS              
    PHASE ONE                                          Oct 2012          9                     
    PHASE ONE                                          Sep 2012          8.5                   
    PHASE ONE                                                            8.75                  
    PHASE THREE                                        Oct 2012          17                    
    PHASE THREE                                        Sep 2012          1                     
    PHASE THREE                                                          9                     
    PHASE TWO                                          Oct 2012          11.5                  
    PHASE TWO                                          Sep 2012          9                     
    PHASE TWO                                                            10.25                 
                                                                         9.33   --It seems to me the figures now is correct. But then when there is no figures for the Phase, it will not display the phase.
    -- is there any way to adjust the select statement so the result for ce.court_name LIKE 'BB' looks like
    PHASE_NUMBER                                       MONTH             AVG_DAYS              
    PHASE ONE                                          Oct 2012          29                    
    PHASE ONE                                          Sep 2012          19                    
    PHASE ONE                                                            24                                       
    PHASE TWO                                          Oct 2012          0                  
    PHASE TWO                                          Sep 2012          0                     
    PHASE TWO                                                            0     
    PHASE THREE                                        Oct 2012          0                   
    PHASE THREE                                        Sep 2012          0                     
    PHASE THREE                                                          0              
                                                                         8      The reason why I need it, because this is just one column that will be included in a union combined in the report that will looks like
    PHASE_NUMBER                                       MONTH             SUM(AVG_IN_PHASE_ALL)  SUM(NUM_IN_PHASE_CURR)
    Phase 1                                            Aug 2012          0                      0                     
                                                       Sep 2012          14.25                  0                     
                                                       Oct 2012          11.14                  1                     
                                                                         8.46                   1                     
    Phase 2                                            Aug 2012          0                      0                     
                                                       Sep 2012          18                     0                     
                                                       Oct 2012          20.33                  2                     
                                                                         12.78                  2                     
    Phase 3                                            Aug 2012          0                      0                     
                                                       Sep 2012          10                     0                     
                                                       Oct 2012          12                     0                     
                                                                         7.33                   0                     
                                                                         9.53                   3                     
    13 rows selected And to put thing in big picture, this is the requirement from the Business Analyst
    The requirements are:
    The user must be able to request the extract for one or more calendar months, e.g.
    May 2013
    May 2013 – Sep 2013.
    The file must contain a separate row for each calendar month in the requested range. Each row must contain the statistics computed for that calendar month.
    The file must also include a row of totals.
    The user must be able to request the extract for either AA or BB or Consolidated (both courts’ statistics accumulated).
    Then the part that I am working on is
    For each monitoring phase:
    Phase name (e.g. “Phase One”)
    Avg_time_in_phase_all_particip
    for each phase name,
    Add up days in each “phase name” Monitoring Phase, calculated as:
    If Monitoring Phase.Date Finished is NULL or > month end date,
    (*Month end date* Minus Monitoring Phase.Date Started Plus 1)
    Otherwise (phase is complete)
    (Monitoring Phase.Date Finished Minus Monitoring Phase.Date Started Plus 1.)
    Divide by the numbers of all participants who have engaged in “phase name”.Thanks again for reading and spending time to help,
    Ann
    Edited by: Ann586341 on Nov 13, 2012 4:31 PM

  • Need help in currency translation

    Hi all;
    I am using this program RSIMPCURR for currency translation in my process chain, it was working in Dev but when I transfer this into QA it's not working because the varient I am using for this is still using source system in for Dev. ; I need to change the source system for the QA system, Anyone knows how to change?
    I went to SE38 and type the program RSIMPCURR and click on the varients but don't see any place where I can change the source system name.
    Any help would be rewarded.
    Thank you.
    Krishma

    hi Krishma,
    normally qa and production are set as 'production' where direct changes are not allowed. perhaps now your qa is opened for changes. also you will need the source system mapping for datasource transport since normally our bw dev and bw qa will have different names. so still you need maintain this later.
    take a look this transport tips, the source system mapping is mentioned there.
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/3010ba90-0201-0010-2896-e58547c6757e
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/e883de94-0501-0010-7d95-de5ffa503a86
    hope this helps.

  • Need help writing a query for following scenario

    Hi all, I need some help writing a query for the following case:
    One Table : My_Table
    Row Count: App 5000
    Columns of Interest: AA and BB
    Scenario: AA contains some names of which BB contains the corresponding ID. Some
    names are appearing more than once with different IDs. For example,
    AA BB
    Dummy 10
    Me 20
    Me 30
    Me 40
    You 70
    Me 50
    Output needed: I need to write a query that will display only all the repeating names with their corresponding IDs excluding all other records.
    I would appreciate any input. Thanks

    Is it possible to have a records with the same values for AA and BB? Are you interested in these rows or do you only care about rows with the same value of AA and different BB?
    With a slight modification of a previous posting you can only select those rows that have distinct values of BB for the same value of AA
    WITH t AS (
    SELECT 'me' aa, 10 bb FROM dual
    UNION ALL
    SELECT 'me' aa, 20 bb FROM dual
    UNION ALL
    SELECT 'you' aa, 30 bb FROM dual
    UNION ALL
    SELECT 'you' aa, 30 bb FROM dual
    SELECT DISTINCT aa, bb
      FROM (SELECT aa, bb, COUNT(DISTINCT bb) OVER(PARTITION BY aa) cnt FROM t)
    WHERE cnt > 1;

Maybe you are looking for

  • UIX form need to clear cached data within session

    HELP! I have some UIX forms created with JHeadStart, thay work fine except but when the underling table data changes (from another user session or an update trigger from different table) the forms will NOT show refreshed data, unless I delete my brow

  • How do I get my ipad to hook up to the itunes store without wifi capabilities?

    I just got an ipad 2 and we dont have wi-fi capabilities.  How do I hook it up to the internet through my computer or phone?

  • Printing invoice with only XML file

    Hi all, I have a problem. When the invoice print with XMLP 5.6.2 is OK, but users want the possibility to reprint the same invoice with the same informations when they want (same if the bill's addresse has changed, for example). Is it possible to rep

  • I am not able to open the html format outputs of SQR

    when I am trying to open SQR html formate output generated by SQR jobs not able to open the html format outputs of SQR getting below error but I am able to open pdf and excel formats outputs "An error was encountered while attempting to retrieve audi

  • Envelope printing is off-centered (Lexmark E238)

    I'm trying to print envelopes via my Lexmark E238. However, they print off-centered, so the addressees appear cut-off at the bottom of the page. If I put in a full sized piece of paper and print on that, it comes out as if the envelope should be just