BPEL round function with precision for a decimal value?

Dear All,
I need to do a rounding of a higher value to 3 precisioned one.
As per the round function available in Jdeveloper, I can only round a decimal to its respective integer value.
But my requirement is to retain the decimal value, but with a limited precision value...
How can I accomplish this.. Is there any extension of round function in BPEL to do this...?
Please update..
Many thanks...

Use the function format-number(variable,precision_num)+.
Thanks,
Sen

Similar Messages

  • Combing rounding functions with other functions

    I am using hyperion reports. Is it possible to combine a rounding function with another function? Specifically, I am taking a variance of actual vs budget where actual and budget are % of total functions. The variance I am getting is off (see ex. below.) I need to keep the actual and budget at 1 decimal point. To correct this problem in excel I am able to round the numbers pulled in by essbase. The ex. below illustrates my problem. Actual .2% Budget .2% Variance .1%

    You may want to make a 'Scenario' for rounding that is rounding the input data. If you make it (variance) 2pass, it will show the difference of the rounded numbers (ie. 0%)Rich [email protected]

  • Function with more than one return value

    Hi
    Please let me know how to write a function with more than one return value and in what scenario should we go for this option.
    Thank you

    user12540019 wrote:
    Please let me know how to write a function with more than one return value and in what scenario should we go for this option.Yes. And the following is the correct approach (using OUT variables is not!) - you deal with the multiple values as a data structure. This example uses an custom (user-defined) SQL data type as the structure.
    SQL> create or replace type TXYcoord is object(
      2          x       number,                  
      3          y       number                   
      4  );                                       
      5  /                                        
    Type created.
    SQL>
    SQL>
    SQL> create or replace function fooCoordinate( someParam number ) return TXYCoord is
      2  begin                                                                         
      3          -- doing some kind of calculation using input parameters              
      4          --  etc..
      5
      6          -- returning the multiple return values as a proper data structure
      7          return(
      8                  TXYcoord( 0, 0 )
      9          );
    10  end;
    11  /
    Function created.
    SQL>
    SQL> -- selecting the data structure
    SQL> select
      2          sysdate,
      3          fooCoordinate(123)      as XY
      4  from       dual;
    SYSDATE             XY(X, Y)
    2010-02-01 08:49:23 TXYCOORD(0, 0)
    SQL>
    SQL> -- selecting the properties/fields of the data structure
    SQL> select
      2          sysdate,
      3          treat( fooCoordinate(123) as TXYcoord).x        as X,
      4          treat( fooCoordinate(123) as TXYcoord).y        as Y
      5  from       dual;
    SYSDATE                      X          Y
    2010-02-01 08:49:23          0          0
    SQL>

  • How can I use JavaScript extention functions with Xalan for transforming XML with XSL

    While transforming standart XML and XSL files to HTML with this servlet:
    package mypackage1;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.util.*;
    import java.net.URL;
    import javax.xml.transform.*;
    import javax.xml.transform.stream.StreamSource;
    import javax.xml.transform.stream.StreamResult;
    import org.mozilla.javascript;
    public class Servlet2 extends HttpServlet
    private static final String CONTENT_TYPE = "text/html; charset=windows-1252";
    public void init(ServletConfig config) throws ServletException
    super.init(config);
    public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException
    try
    response.setContentType(CONTENT_TYPE);
    PrintWriter out = response.getWriter();
    TransformerFactory tFactory = TransformerFactory.newInstance();
    Source xmlSource = new StreamSource(new FileReader("c:/aaa.xml"));
    Source xslSource = new StreamSource(new FileReader("c:/bbb.xsl"));
    Transformer transformer = tFactory.newTransformer(xslSource);
    transformer.transform (xmlSource, new StreamResult(out));
    catch (Exception e)
    e.printStackTrace();
    everything is going ok,
    but when try to use javascript function in XSL file, for example like in this:
    <?xml version="1.0"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
    xmlns:lxslt="http://xml.apache.org/xslt" xmlns:my-ext="ext1"
    extension-element-prefixes="my-ext">
    <lxslt:component prefix="my-ext"
    functions="getdate">
    <lxslt:script lang="javascript">
    function getdate() {
    var d = new Date();
    return d.toUTCString();
    </lxslt:script>
    </lxslt:component>
    <xsl:template match="/">
    <p><xsl:copy-of select="my-ext:getdate()"/></p>
    </xsl:template>
    </xsl:stylesheet>
    recieve error-message:
    XSL-1000: (Fatal Error) Error while parsing XSL file (Extension function namespace should start with 'http://www.oracle.com/XSL/Transform/java/'.).
    What kind of namespace I should specify?

    Hello, Paul.
    I'm sure you may not use JavaScript as a language for creating XSLT extention functions with Oracle XDK Parser. This is since parser might have JavaScript interpreter to work with JavaScript, but it has not.
    If you need to build any XSLT extention functions you must build them as Java class' static methods.
    After that, you define the usage of the class by mean of namespace declaration as:
    xmlns:your-ns="http://www.oracle.com/XSL/Transform/java/yourpackage.Yourclass"
    (Prefix "http://www.oracle.com/XSL/Transform/java/" may differs if you use non-Oracle XML parser)
    and use class' static method in XSLT:
    <xsl:value-of select="your-ns.staticMethodName(paramsIfAny)"/>
    In your case you may wish to use standard Date class:
    xmlns:date="http://www.oracle.com/XSL/Transform/java/java.util.Date"
    <xsl:value-of select="date:toString(date:new)"/>

  • [8i] Help with function with parameters (for workday calculation)

    Let me start by saying, I've never written a function before, and I don't have access to create a function in my database (i.e. I can't test this function). I'm trying to come up with a function that I can ask my IT department to add for me. I'm hoping someone can take a look at what I've written and tell me if it should work or not, and if this is the right way to go about solving my problem.
    I am trying to create a function to do a very simple workday calculation (adding/subtracting a particular number of workdays from a calendar date).
    The database I'm working with has a table with the workday calendar in it. Here is a sample table and sample data, representative of what's in my workday calendar table:
    CREATE TABLE caln
    (     clndr_dt     DATE,
         shop_days     NUMBER(5)
         CONSTRAINT caln_pk PRIMARY KEY (clndr_dt)
    INSERT INTO     caln
    VALUES (To_Date('01/01/1980','mm/dd/yyyy'),0);
    INSERT INTO     caln
    VALUES (To_Date('01/02/1980','mm/dd/yyyy'),1);
    INSERT INTO     caln
    VALUES (To_Date('01/03/1980','mm/dd/yyyy'),2);
    INSERT INTO     caln
    VALUES (To_Date('01/04/1980','mm/dd/yyyy'),3);
    INSERT INTO     caln
    VALUES (To_Date('01/05/1980','mm/dd/yyyy'),3);
    INSERT INTO     caln
    VALUES (To_Date('01/06/1980','mm/dd/yyyy'),3);
    INSERT INTO     caln
    VALUES (To_Date('01/07/1980','mm/dd/yyyy'),4);
    INSERT INTO     caln
    VALUES (To_Date('01/08/1980','mm/dd/yyyy'),5);
    INSERT INTO     caln
    VALUES (To_Date('01/09/1980','mm/dd/yyyy'),6);
    INSERT INTO     caln
    VALUES (To_Date('01/10/1980','mm/dd/yyyy'),7);
    INSERT INTO     caln
    VALUES (To_Date('01/11/1980','mm/dd/yyyy'),8);
    INSERT INTO     caln
    VALUES (To_Date('01/12/1980','mm/dd/yyyy'),8);
    INSERT INTO     caln
    VALUES (To_Date('01/13/1980','mm/dd/yyyy'),8);
    INSERT INTO     caln
    VALUES (To_Date('01/14/1980','mm/dd/yyyy'),9);The actual table includes from 1/1/1980 though 12/31/2015.
    I've written (and validated) this parameter query which does my workday (mday) calculation:
    SELECT     cal.clndr_dt
    FROM     CALN cal
         SELECT     cal.shop_days+:mdays     AS new_shop_days
         FROM     CALN cal
         WHERE     cal.clndr_dt     =:start_date
         ) a
    WHERE     cal.shop_days     = a.new_shop_days
    AND     ROWNUM          =1
    ORDER BY     cal.clndr_dt;Based on this query, I've created the following function (and I have no clue if it works or if the syntax is right, etc.):
    CREATE OR REPLACE FUNCTION add_mdays
         (start_date     IN DATE,
         mdays          IN NUMBER(5))
    RETURN     DATE
    IS
         new_date DATE;
    BEGIN
         SELECT     cal.clndr_dt
         FROM     CALN cal
              SELECT     cal.shop_days+mdays     AS new_shop_days
              FROM     CALN cal
              WHERE     cal.clndr_dt     =start_date
              ) a
         WHERE     cal.shop_days     = a.new_shop_days
         AND     ROWNUM          =1
         ORDER BY     cal.clndr_dt;
         RETURN     new_date;
    END add_mdays;  //edit 9:31 AM - noticed I left off this bitI'm also not sure how to have the function handle results that would return a date outside of the date range that is in the table (Before 1/1/1980 or after 12/31/2015--or, another way to look at it is, before the MIN value of caln.clndr_dt or after the MAX value of caln.clndr_dt).
    My goal is to be able to use the function in a situation like the following:
    First, here's a sample table and data:
    CREATE TABLE orders
    (     ord_no          NUMBER(5),
         plan_start_dt     DATE,
         CONSTRAINT orders_pk PRIMARY KEY (ord_no)
    INSERT INTO orders
    VALUES (1,To_Date('01/08/1980','mm/dd/yyyy'));
    INSERT INTO orders
    VALUES (2,To_Date('01/09/1980','mm/dd/yyyy'));
    INSERT INTO orders
    VALUES (3,To_Date('01/10/1980','mm/dd/yyyy'));And here is how I would like to use my function:
    SELECT     orders.ord_no
    ,     orders.plan_start_dt
    ,     add_mdays(orders.plan_start_dt, -3) AS prep_date
    FROM     ordersThus, the function would allow me to return, for every order in my orders table, the date that is 3 workdays (mdays) prior to the plan start date of each order.
    Am I going about this the right way? Do I need to create a function to do this, or is there a way for me to incorporate my query (that does my mday calculation) into the sample query above (eliminating the need to create a function)?
    Thanks much in advance!
    Edited by: user11033437 on Feb 2, 2010 8:55 AM
    Fixed a couple typos in the last insert statements
    Edited by: user11033437 on Feb 2, 2010 9:31 AM (fixed some syntax in the function)

    Hi,
    Ah, mentioning Oracle 8 and not being able to test your own code makes me nostalgic for the good old days, when you typed your cards, and brought them to a window at the computer center, and waited an hour for the job to run, and then saw the printout to find that you had made a typo.
    If you're going to write functions, you really need to test them yourself. Like all code, functions whould be written in baby steps: write a line or two (or sometimes just part of what will later become one line), test, make sure it's running correctly, and repeat.
    Ideally, your employer should create a developement schema in a development database for you to use.
    You can legally download your own instance of Oracle Express Edition for free; just be careful not to use features that aren't available in the database where the code will be deployed.
    You don't need a function to get the results you want:
    SELECT       o.ord_no
    ,       o.plan_start_dt
    ,       MIN (e.clndr_dt)     AS prep_date
    FROM       orders     o
    ,       caln          l
    ,       caln          e
    WHERE       l.clndr_dt     = o.plan_start_dt
    AND       e.shop_days     = l.shop_days - 3
    GROUP BY  o.ord_no
    ,            o.plan_start_dt
    ;This would be more efficient (and a little simpler) if you added a column (let's call it work_day) that identified if each row represented a work_day or not.
    For each value of shop_days, exactly 1 row will be marked as a work day.
    Then the query might be something like:
    SELECT       o.ord_no
    ,       o.plan_start_dt
    ,       e.clndr_dt          AS prep_date
    FROM       orders     o
    ,       caln          l
    ,       caln          e
    WHERE       l.clndr_dt     = o.plan_start_dt
    AND       e.shop_days     = l.shop_days - 3
    AND       e.work_day     = 1
    ;You could use the analytic LAG function to populate the work_day column.
    A function would certainly be handy, though perhaps slower.
    The function you posted has a few mistakes:
    (a) An argument can't be declared as NUMBER (5); just NUMBER.
    (b) When you SELECT in PL/SQL, like you're doing, you have to SELECT INTO some variable to hold the results.
    (c) ROWNUM is arbitrary (which makes it useless in this problem) unless you are drawing from an ordered sub-query. I don't think you can use ORDER BY in sub-queries in Oracle 8. Use the analytic ROW_NUMBER function instead.
    (d) The function must end with an END statement.
    Given your current caln table, here's how I would write the function:
    CREATE OR REPLACE FUNCTION add_mdays
         ( start_date     IN           DATE          DEFAULT     SYSDATE,
           mdays          IN           NUMBER          DEFAULT     1
    RETURN     DATE
    DETERMINISTIC
    IS
         --     add_mdays returns the DATE that is mdays working days
         --     after start_date.  (If mdays < 0, the DATE returned
         --     will be before start_date).
         --     Work days do not include Saturdays, Sundays or holidays
         --     as indicated in the caln table.
         new_date     DATE;          -- to be returned
    BEGIN
         SELECT     MIN (t.clndr_dt)
         INTO     new_date
         FROM     caln     f     -- f stands for "from"
         ,     caln     t     -- t stands for "to"
         WHERE     f.clndr_dt     = TRUNC (start_date)
         AND     t.shop_days     = f.shop_days + TRUNC (mdays)
         RETURN     new_date;
    END     add_mdays;
    SHOW ERRORSProduction code whould be robust (that includes "idiot-proofing").
    Try to foresee what errors people might make in calling your function, and correct for them when possible.
    For example, if it only makes sense for start_date to be midnight, or mdays to be an integer, then use TRUNC in the function in case soembody passes a bad value.
    Allow for default arguments.
    Comment your function. Put all comments within the function (that is, after CREATE and before the final END) so that they will be kept in the data dictionary.
    If, given the same arguments, the function always returns the same value, mark it as DETERMINISTIC, for efficiency. This means the system may remember values passed back rather than call the function every time it is told to.
    I wish I could mark questions as "Correct" or "Helpful"; you'd get 10 points for sure.
    You posted CREATE TABLE and INSERT statements (without even being begged).
    You gave a clear description of the problem, including desired results.
    The code is nicely formatted and easy to read.
    All around, one of the most thoughtful, well-written questions I've seen.
    Well done! Keep up the good work!
    Edited by: Frank Kulash on Feb 2, 2010 1:10 PM
    Added my own version of the function.

  • Public int indexOf(int ch, int fromIdx) doesn't work for some decimal value

    I have tested two strings below. These two string are identical, except the first string has a char 'ƒ, which has a decimal value of 131. And the second string has a char 'À', which has a decimal value of 192. I am expecting the same output, which is 11, but I got -1 for the test I did using the first string. In the API for public int indexOf(int ch, int fromIndex), values of ch is in the range from 0 to 0xFFFF (inclusive). It is highly appreciated if anyone could provide any insights on why -1 returned when the first string is tested. Thank you in advance.
    String strHasDecimal131 = "Test value ƒ, it has a decimal value of 131";
    String strHasDecimal192 = "Test value À, it has a decimal value of 192";
    int badDecimal = 131;
    int idxBadDecimal = strHasDecimal131.indexOf( badDecimal, 0);
    System.out.println( "index of Bad Decimal: " + idxBadDecimal );
    The output is: index of Bad Decimal -1
    int badDecimal = 192;
    int idxBadDecimal = strHasDecimal192.indexOf( badDecimal, 0);
    System.out.println( "index of Bad Decimal: " + idxBadDecimal );
    The output is: index of Bad Decimal: 11

    Thank you everyone for your inputs. Following are the print statements and the output: for character 'ƒ' and ' À':
    System.out.println((int)'\u0083' + ", " + (int)'\u00C0' + " print decimal value" );
    Output: 131, 192 print decimal value
    System.out.println((char)'\u0083' + ", " + (char)'\u00C0' + " print character value" );
    Output: ?, À print character value
    According to Latin-1 Supplement table, the first char in the output would have the appearance of ƒ, instead it has the appearance of ?
    System.out.println( (int)'ƒ' + ", "+ (int)'À' + " print integer value");
    Output: 402, 192 print integer value
    I also have tried to print out the decimal value of following char: € &#65533; ‚ ƒ „ … † ‡, according to Latin-1 Supplement table, these char has decimal value of 128 through 135 and hex value 0x0080 through 0x0087. And the output from java println is: 8364 65533 8218 8222 8230 402 8224 8225.
    System.out.println((int)'€' + " " + (int)'&#65533;' + " " + (int)'‚' + " " +(int)'„' + " " + (int)'…' + " " +(int)'ƒ' + " " + (int)'†' + " " + (int)'‡' );
    As I did before, I print out character of decimal value of 128 through 135
    System.out.println((char)128 + " " + (char)129 + " " + (char)130 + " " +(char)131 + " " + (char)132 + " " +(char)133 + " " + (char)134 + " " + (char)135 );
    Output: ? ? ? ? ? ? ? ?
    Not sure why java prints character for decimal value of 128 through 159 differently from what appears in the Latin-1 Supplement table. Any of your inputs are appreciately.

  • Creating a function with  a for loop and %type

    Hello,
    I am trying to create a function which contains a for loop as well as %type.
    This function is on a student table and i am trying to create a function which will display the zip which is a varchar2(5).
    I need to do this through this function.
    However, I can't seem to get it running.
    Can anyone help?
    below is what i tried as well as other options and was not successful.
    I also displayed my error with the show error command.
    SQL> create or replace function zip_exist
    2 return varchar2
    3 is
    4 v_zip student.zip%TYPE;
    5 cursor c_zip is
    6 select zip
    7 from
    8 student
    9 where zip=zip;
    10 begin
    11 open c_zip;
    12 v_zip IN c_zip
    13 loop
    14 v_zip:=c_zip%TYPE;
    15 end loop;
    16 close c_zip;
    17 end;
    18 /
    Warning: Function created with compilation errors.
    SQL> show error
    Errors for FUNCTION ZIP_EXIST:
    LINE/COL ERROR
    12/7 PLS-00103: Encountered the symbol "IN" when expecting one of the
    following:
    := . ( @ % ;
    16/1 PLS-00103: Encountered the symbol "CLOSE"
    SQL>
    kabrajo

    user10873577 wrote:
    Hello,
    I am trying to create a function which contains a for loop as well as %type.
    This function is on a student table and i am trying to create a function which will display the zip which is a varchar2(5).
    I need to do this through this function.
    However, I can't seem to get it running.
    Can anyone help?
    below is what i tried as well as other options and was not successful.
    I also displayed my error with the show error command.
    SQL> create or replace function zip_exist
    2 return varchar2
    3 is
    4 v_zip student.zip%TYPE;
    5 cursor c_zip is
    6 select zip
    7 from
    8 student
    9 where zip=zip;
    10 begin
    11 open c_zip;
    12 v_zip IN c_zip
    13 loop
    14 v_zip:=c_zip%TYPE;
    15 end loop;
    16 close c_zip;
    17 end;
    18 /
    Warning: Function created with compilation errors.
    SQL> show error
    Errors for FUNCTION ZIP_EXIST:
    LINE/COL ERROR
    12/7 PLS-00103: Encountered the symbol "IN" when expecting one of the
    following:
    := . ( @ % ;
    16/1 PLS-00103: Encountered the symbol "CLOSE"
    SQL>
    kabrajoTry This
    Create a sample table
    SQL> create table student(id number(10),zip varchar2(5));
    Table created.Insert the record
    SQL> insert into student values(1111,'A5454');
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> select * from student;
            ID ZIP
          1111 A5454
    SQL> create or replace function zip_exist(v_id number)
      2   return varchar2
      3   is
      4   v_zip student.zip%TYPE;
      5  BEGIN
      6   select zip
      7   INTO v_zip
      8   FROM student
      9   where id=v_id;
    10   Return v_zip;
    11  EXCEPTION WHEN NO_DATA_FOUND THEN
    12                  RETURN 'INVALD';
    13  WHEN OTHERS THEN
    14                 return  'NA!';
    15   end;
    16  /
    Function created.
    SQL> set serveroutput on
    SQL> select zip_exist(1111) from dual;
    ZIP_EXIST(1111)
    A5454
    SQL> select zip_exist(2222) from dual;
    ZIP_EXIST(2222)
    INVALDHope this helps
    Regards,
    Achyut K

  • How to round quantity with FMS for some items in Production order lines?

    Hello,
    How to round the quantity with FMS or SP for only some items in the composition of Production order (lines) and the bill of materials like a box or a stick that should not be with commas.
    Exemple  of Production Order
    P1
      M1 | 234,78
      M2 | 104,04 --> 104
      M3 | 60,7
      M4 | 512, 00
      M5 | 107,67 --> 108
    and others will not be rounded
    Thanks,
    Hafid

    Hi Gordon,
    you're always the first to respond, thank you.
    Its when adding the production order, before its creation or when entering the quantity of product in OWOR.
    Like :
    SELECT CASE WHEN ($[$37.4.0] = 'M2') OR ($[$37.4.0] = 'M5') THEN ROUND (T0.[PlannedQty],0)
    ELSE T0.[PlannedQty] END AS PlannedQty FROM WOR1 T0
    or
    SELECT ROUND (T0.[PlannedQty],0) FROM WOR1 T0 WHERE T0.[ItemCode] =$[$37.4.0] AND (T0.[ItemCode] = 'M2' OR  T0.[ItemCode] = 'M5)
    Thanks,
    Hafid

  • XMLGEN: Produce XML dump of a table WITH tags for null column values

    I am new to generating XML so bear with me....
    We have a customer who needs an XML extract of data, including tags for any column that is null.
    I created a simple test case below using DBMS_XMLGEN.getXML. The first row (A1) has no null values and thus tags for columns A, BEE and CEE are produced. The second row (A2) has null in column BEE and thus tags for only columns A and CEE are produced.
    Is there a way to force a tag for null column BEE in the second row?
    create table foo (A varchar2(10), BEE number, CEE date);
    insert into foo values ('A1',1,sysdate);
    insert into foo values ('A2',null,sysdate);
    SELECT DBMS_XMLGEN.getXML('SELECT * FROM foo') FROM dual;
    <ROWSET>
    <ROW>
    <A>A1</A>
    <BEE>1</BEE>
    <CEE>27-SEP-12</CEE>
    </ROW>
    <ROW>
    <A>A2</A>
    <CEE>27-SEP-12</CEE>
    </ROW>
    </ROWSET>

    What's the database version? (SELECT * FROM v$version)
    Could you use this instead :
    SQL> select xmlserialize(document
      2           xmlelement("ROWSET",
      3             xmlagg(
      4               xmlelement("ROW",
      5                 xmlelement("A", a)
      6               , xmlelement("BEE", bee)
      7               , xmlelement("CEE", cee)
      8               )
      9             )
    10           )
    11         -- for display purpose only :
    12         as clob indent
    13         )
    14  from foo
    15  ;
    XMLSERIALIZE(DOCUMENTXMLELEMEN
    <ROWSET>
      <ROW>
        <A>A1</A>
        <BEE>1</BEE>
        <CEE>2012-09-27</CEE>
      </ROW>
      <ROW>
        <A>A2</A>
        <BEE/>
        <CEE>2012-09-27</CEE>
      </ROW>
    </ROWSET>
    Or,
    SQL> select xmlserialize(document
      2           xmlquery(
      3             '(#ora:view_on_null empty #)
      4             {
      5               <ROWSET>{fn:collection("oradb:/DEV/FOO")}</ROWSET>
      6             }'
      7             returning content
      8           )
      9           as clob indent
    10         )
    11  from dual;
    XMLSERIALIZE(DOCUMENTXMLQUERY(
    <ROWSET>
      <ROW>
        <A>A1</A>
        <BEE>1</BEE>
        <CEE>2012-09-27</CEE>
      </ROW>
      <ROW>
        <A>A2</A>
        <BEE/>
        <CEE>2012-09-27</CEE>
      </ROW>
    </ROWSET>
    (where "DEV" is my test schema)
    If you want to stick with DBMS_XMLGEN, you're gonna have to use PL/SQL and setNullHandling procedure.
    Edited by: odie_63 on 27 sept. 2012 17:14

  • Runtime paging with java for the database values.

    I m preparing a project in which i cant try to page the data etracted from the database in runtime. Plz Help me for this problem.

    import java.sql.Connection;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.sql.DriverManager;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.StringTokenizer;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import org.apache.struts.action.Action;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    public class AttachFormPagination extends Action
      public AttachFormPagination()
      public ActionForward execute(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws Exception
              try
                   int tot = 0;
                   String startIndex = request.getParameter("start");
                   String endIndex = request.getParameter("end");
                   System.out.println("---------start is>" + startIndex);
                   System.out.println("---------end is>" + endIndex);
                   int sIndex = Integer.valueOf(startIndex).intValue();
                   int eIndex = Integer.valueOf(endIndex).intValue();
                Class.forName("org.gjt.mm.mysql.Driver");
                   Connection con=DriverManager.getConnection("jdbc:mysql://localhost/","id","pw");
                   Statement st = con.createStatement();
                   // this is for getting the total records
                   Statement st1 = con.createStatement();
                   ResultSet rs1 = st1.executeQuery("select * from tablename");
                   while(rs1.next())
                        tot++;
                   System.out.println("total value is" + tot);
                   String total = ""+tot;
                   String query = "select * from tablename limit " + sIndex + "," + eIndex;
                   System.out.println("---------query is>" + query);
                   ResultSet rs = st.executeQuery(query);
                   List cusList = new ArrayList();
                   AttachFormBean afb = null;
                   while(rs.next())
                        afb = new AttachFormBean();
                        afb.setName(rs.getString(1));
                        afb.setActivity(rs.getString(2));
                        afb.setProduct(rs.getString(3));
                        afb.setCompetitor(rs.getString(4));
                        afb.setEnvironment(rs.getString(5));
                        afb.setCreatedBy(rs.getString(6));
                        cusList.add(afb);
                   request.setAttribute("custlist",cusList);
                   request.setAttribute("startIndex",startIndex);
                   request.setAttribute("endIndex",endIndex);
                   request.setAttribute("total",total);
              catch (Exception e)
                   System.out.println("Exception---------"+e);
              return mapping.findForward("success");
    }and
    this code to be placed in ur page
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
              <tr>
                   <td align="left">�</td>
                   <td nowrap align="right">
                   <a href="#" onclick="PagenationStart()">
                   <img src='images/start_off.gif' width='9' height='8' alt='Start'  border='0' align='absmiddle' href="#" >�Start��</a>
                   <a href="#" onclick="PagenationPrevious()">
                   <img src='images/previous_off.gif' width='4' height='8' alt='Previous'  border='0' align='absmiddle'>�Previous��</a>
                   <a href="#" onclick="PagenationNext()">
                   ��Next�<img src='images/next_off.gif' width='4' height='8' alt='Next'  border='0' align='absmiddle'></a>
                   <a href="#" onclick="PagenationEnd()">
                   ��End�<img src='images/end_off.gif' width='9' height='8' alt='End'  border='0' align='absmiddle'></a></td>
              </tr>
         </table>and put this in ur page inside script
    function PagenationStart()
         var a = 0;
         var b = 4;
         document.ownerPage.action="actionpagename.do?param="+param+"&start="+a+"&end="+b;
         document.ownerPage.submit();
    function PagenationPrevious()
         var a = eval('<c:out value="${requestScope.startIndex}"/>') - 4;
         var b = 4;
         document.ownerPage.action="actionpagename.do?param="+param+"&start="+a+"&end="+b;
         document.ownerPage.submit();
    function PagenationNext()
         var a = eval('<c:out value="${requestScope.startIndex}"/>')+4;
         var b = 4;
         document.ownerPage.action="actionpagename.do?param="+param+"&start="+a+"&end="+b;
         document.ownerPage.submit();
    function PagenationEnd()
         var a = eval('<c:out value="${requestScope.total}"/>')-4;
         var b = eval('<c:out value="${requestScope.total}"/>');
         document.ownerPage.action="actionpagename.do?param="+param+"&start="+a+"&end="+b;
         document.ownerPage.submit();
    }

  • Help needed with domparsers for accessing TextNode value

    Hi,
    My input appears like this.
    <header>
    <Data>bhargav</Data>
    <header>
    i need to write a java mapping code where i need to access the value of <Data>.It is a type String and Category is element.In my java code i need to take this content of <Data> into a String.
    Thanks in advance,
    Bhargav
    Message was edited by:
            bhargav gundabolu

    Hi,
    Im using this java mapping to solve the level-2 hierarchical issue that occures with content conversion.I have written my java mapping using domparsers and StreamTransformation. and the output is coming fine.But in one case i need to access the value of the <Data> node and make some changes to it.But im unable to do it as <Data> here is a text node.
    Thanks,
    Bhargav

  • PCI-4472 not functioning with DAQmx Linux 8.0

    We have multiple systems with PCI-4472 cards in them running SUSE Linux, and all but one of them function properly.  On the particular system in question (which has identical hardware and software to the functioning systems), nilsdev lists no devices.  Further investigation revealed the following excerpt from dmesg:
    allocation failed: out of vmalloc space - use
    vmalloc=<size> to increase size.
    Unable to handle kernel NULL pointer dereference at virtual address
    000002fc
     printing eip:
    f9ede608
    *pde = 00000000
    Oops: 0002 [#1]
    SMP
    Modules linked in: nidsark nistcrk nicdrk nistc2k nimru2k nimxpk ipt_pkttype
    ipt_LOG ipt_limit nipxirmk nidimk nimsdrk nidmxfk nimxdfk nimstsk nimdbgk
    niorbk speedstep_lib freq_table nipalk nikal snd_pcm_oss snd_mixer_oss snd_seq
    snd_seq_device button battery ac af_packet video1394 raw1394 edd ide_cd cdrom
    sk98lin ohci1394 ieee1394 snd_intel8x0 snd_ac97_codec snd_ac97_bus snd_pcm
    snd_timer snd soundcore snd_page_alloc i2c_i801 i2c_core hw_random generic
    ehci_hcd intel_agp agpgart uhci_hcd usbcore shpchp pci_hotplug ip6t_REJECT
    ipt_REJECT ipt_state iptable_mangle iptable_nat iptable_filter ip6table_mangle
    ip_conntrack ip_tables ip6table_filter ip6_tables ipv6 parport_pc lp parport
    nls_iso8859_1 nls_cp437 vfat fat nls_utf8 ntfs dm_mod ext3 jbd sg fan thermal
    processor ata_piix libata piix sd_mod scsi_mod ide_disk ide_core
    CPU:    1
    EIP:    0060:[<f9ede608>]    Tainted: PF    U VLI
    EFLAGS: 00010246   (2.6.13-15-smp)
    EIP is at nidsark-unversioned0004550+0x70/0x11e4 [nidsark]
    eax: 00000000   ebx: f6be1d68   ecx: 00000000   edx: 00000000
    esi: f6514770   edi: f6514760   ebp: f6be1964   esp: f6be1958
    ds: 007b   es: 007b   ss: 0068
    Process nipalsm (pid: 6952, threadinfo=f6be0000 task=c2344540)
    Stack: f6be1d68 f6514b68 f6be1d68 f6be197c f9efb4d0 f6514760 f6be1d68 f6514b68
           f6b82690 f6be1a1c f9e93409
    f6514b68 f6be1d68 f6514760 f6be1d68 00000004
           f6be1d6c 00000100 f6be19b8
    f95bbf19 f6be1bd0 f6be1d6c f6be1d6c f6be1b98
    Assuming that the NULL pointer deference was caused by the preceding failed vmalloc, I attempted to increase the vmalloc size to 512MB (which is certainly overkill).  This did nothing to clear the error.  One final detail is that this computer dual boots Windows, while the others have only ever run Linux.  It shouldn't matter, but I feel it is worth mentioning in the event that DAQmx for Windows somehow mangles the configuration of the card to a point where it no longer functions with DAQmx for Linux.  It should be noted that the card works just fine under Windows.
    I have the output from niSystemReport available in the event that it will help in diagnosing the problem, but am unable to attach it due to the size restriction of this forum.  The call trace from dmesg is in the attached file.  Any help would be greatly appreciated.
    -Peter Lisherness
    Message Edited by PeterLisherness on 07-10-2006 12:36 PM
    Attachments:
    dmesg.txt ‏5 KB

    Peter,
    I have a couple of other questions which might help us narrow this down.
    1.  You said both the working and non working machines have identical hardware and software.  I'm assuming this means both machines are Pentium 4 3.2 GHz SMP machines 2 GB of RAM, have the same motherboards etc.  I also assume that this means that they also are both running SUSE 10.0 and have the same updates, and kernel versions.  Is this correct?  A system report from the working machine could also help us confirm this.
    2.  Can you easily reproduce the Oops?  When does it occur?  Does it happen when the machine first boots up, or do you have to run nilsdev first?
    Thanks,
    Shawn B.
    Use NI products on Linux? Come join the NI Linux Users Community

  • BAPI explorer functions with java

    I am a newbie in SAP.
    I have tested out some sample JCO programs. Then worked fine.
    Now I want to go for some more.
    Is it possible to implement applications like BAPI explorer with JCo ?
    Basically I want to be able to list all the BAPIs with JCo ?
    I have tried "RFC_FUNCTION_SEARCH" with "*" entry for all input values and
    the output was null. 
    How do I list all the BAPIs with JCo (Java Program)
    Thanks !!!!

    I was asking so obvious question with simple answer.
    I have figured it out and it worked great. It's been a week since I started JCo program.
    Anyway my problem was RFC_FUNCTION_SEARCH returns output in a table.
    So I had to look up the table for result message.
    Now I am asking another ? I have searched the forum already and couldn't find the answer.
    How do I create the hierarchical view of BAPI with JCo ?
    Basically I want to implement something like BAPI explorer (tree navigator) with Java.

  • Decimal values in SP15

    Hi,
    we're on SP15 and try to save decimal values like 15000,34) with the help of a bapi.
    When we save 15000,00 everything works fine.
    When we try to save 15000,23, the bapi only receives 0,00 and thus 0 is stored.
    The Input field in VC is of type "number" as well as the input field of the bapi.
    Who knows how to forma the input field in visual composer?
    Thanks a lot and kind Regards,
      Benni

    Hi ,
    Sorry Here my server is not wrkg . can please check on properties of inputfield. there u can find ceil or round Function u can Restirct the Number values .
    Note :
    1) Here u want to display only exact amount like 1000 or With decimals 1000.00 .
    2)can u elaborate ur question brief so tht i can some idea.
    Regard s,
    venkat

  • Decimal Values getting truncated

    Hi,
    In my query results, the decimal values are getting truncated.  e.g.
    0.30 + 0.44 = 0.70  (expected result = 0.74)
    0.30 + 0.45 = 0.80  (expected result = 0.75)
    0.40 + 0.48 = 0.80  (expected result = 0.78)
    What am I supposed to do to make sure that the second decimal point is not truncted.
    Thanks,

    Hi,
    I do not have any conditions.  Except that I am just using the function NODIM to get the decimal values in my report.
    I did tried using the decimal places in the Key Figure properties.
    Are there any other possibilities to solve this?
    Thanks,

Maybe you are looking for