How to get a value from the previous element (XSLT/XPATH gurus ahoy!)

Hi All,
I am building an RTF template for a "letter of reference"-report. Sometimes there are several rows in the data, that need to be printed as one. This is due to consecutive temporary contracts, which will be printed out as one period of service.
Here's a simplified data example to illustrate the problem.
<ROW>
<START_DATE>01-01-1980</START_DATE>
<END_DATE>01-01-1988</END_DATE>
</ROW>
<ROW>
<START_DATE>01-01-1988</START_DATE>
<END_DATE>01-01-1990</END_DATE>
</ROW>
<ROW>
<START_DATE>01-01-2000</START_DATE>
<END_DATE>01-01-2005</END_DATE>
</ROW>
With the data above, I should print two lines:
01-01-1980 - 01-01-1990
01-01-2000 - 01-01-2005
I need to compare START_DATE of an element (except for the first one) with the END_DATE of the previous element, to find out whether to print the END_DATE for that element or not. How can I get that value from the previous element?
Thanks & Regards, Matilda

use this to get the following End_date
<?following-sibling::../END_DATE?>
Try this
<?for-each:/ROOT/ROW?>
==================
Current StartDate <?START_DATE?>
Current End Date <?END_DATE?>
Next Start Date <?following-sibling::ROW/END_DATE?>
Previous End Date <?preceding-sibling::ROW[1]/END_DATE?>
================
<?end for-each?>
o/p
==================
Current StartDate 01-01-1980
Current End Date 01-01-1988
Next Start Date 01-01-1990
Previous End Date
================
==================
Current StartDate 01-01-1988
Current End Date 01-01-1990
Next Start Date 01-01-2005
Previous End Date 01-01-1988
================
==================
Current StartDate 01-01-2000
Current End Date 01-01-2005
Next Start Date
Previous End Date 01

Similar Messages

  • How to get maximal value from the data/class for show in Map legend

    I make WAD report that using Map Web Item.
    I devide to four (4) classes for legend (Generate_Breaks).
    I want to change default value for the class by javascript and for this,
    I need to get maximal value from the class.
    How to get maximal value from the data/class.
    please give me solution for my problem.
    Many Thx
    Eddy Utomo

    use this to get the following End_date
    <?following-sibling::../END_DATE?>
    Try this
    <?for-each:/ROOT/ROW?>
    ==================
    Current StartDate <?START_DATE?>
    Current End Date <?END_DATE?>
    Next Start Date <?following-sibling::ROW/END_DATE?>
    Previous End Date <?preceding-sibling::ROW[1]/END_DATE?>
    ================
    <?end for-each?>
    o/p
    ==================
    Current StartDate 01-01-1980
    Current End Date 01-01-1988
    Next Start Date 01-01-1990
    Previous End Date
    ================
    ==================
    Current StartDate 01-01-1988
    Current End Date 01-01-1990
    Next Start Date 01-01-2005
    Previous End Date 01-01-1988
    ================
    ==================
    Current StartDate 01-01-2000
    Current End Date 01-01-2005
    Next Start Date
    Previous End Date 01

  • How to get multiple values from the list

    I've a list of an item which I queried it from the database. I also created a button that will takes a selected items from the list when it was clicked. I used javabean to get the data from database.
    <%     // clicked on Select District Button
    Vector vselectedDistrict = new Vector();
    Vector vdistrictID = new Vector();
    String tmpSelectDistrict = "";
    tmpSelectDistrict = request.getParameter("bSelectDistrict");
    if(tmpSelectDistrict != null)
         // get multiple values from the list
         String[] selectedDistrict = request.getParameterValues("usrTDistrict");
         vselectedDistrict.clear();
         vdistrictID.clear();
         if((selectedDistrict != null) && (selectedDistrict.length != 0))
                             for(int i=0;i<selectedDistrict.length;i++)
                   vselectedDistrict.addElement(selectedDistrict);           
              vdistrictID = dbaseInfo.getcurrentDistrictID(nstate,vselectedDistrict);
              for(int i=0;i<vdistrictID.size();i++)
                   out.println("district = " + selectedDistrict[i]);                         out.println("district ID= " + vdistrictID.get(i).toString());
    %>
    // get vdistrict from the database here......
    <select name="usrTDistrict" size="5" multiple>
    <%     for(int i = 0; i< vdistrict.size(); i++)
    %>
         <option value="<%=vdistrict.get(i).toString()%>"><%=vdistrict.get(i).toString()%></option>
    <%
    %>          
    </select>
    <input type="submit" name="bSelectDistrict" value="Select District">
    Lets say the item that i selected from the list is 'Xplace' and I clicked on the Select District button,
    what I got is this error message:
    org.apache.jasper.JasperException: Unable to convert string 'Xplace' to class java.util.Vector for attribute usrTDistrict: java.lang.IllegalArgumentException: Property Editor not registered with the PropertyEditorManager
    So where is going wrong and what the message means?. Any help very much appreciated. Thanks

    These are just guesses that might hopefully steer you in directions you haven't looked in yet.
    I presume you used triangle brackets (< >) to avoid having the Jive Forum think it was the "italics" tag?
    Are you certain this: dbaseInfo.getcurrentDistrictID(nstate,vselectedDistrict);
    expects a Vector as its second parameter? And returns a Vector?
    I don't believe you've shown how you use the javabean, or its code? Perhaps it should be rewritten to accept an array of strings instead of a Vector?

  • UDF: how to get a value in the previous record when lopping over records?

    Hello
    I have this challenge:
    Source message:
    <row>
      <ID>111</ID>
      <Score>200</Score>
      <Date>2010-01-01</Date>
    </row>
    <row>
      <ID>111</ID>
      <Score>230</Score>
      <Date>2010-01-02</Date>
    </row>
    <row>
      <ID>112</ID>
      <Score>230</Score>
      <Date>2010-01-03</Date>
    </row>
    etc...
    Now the case is, that IF the value of ID of the current record (row) is equal to the value of the ID of the previous record AND the Score value of the current record is bigger than the Score value of the previous record THEN a record in the target message must be created with these values:
    Target Message:
    <row>
      <ID_target> value of source ID </ID_target>
      <Score_yesterday> Score value of previous record (day) </Score_yesterday>
      <Score_current_date> Score value of current record </Score_current_date>
      <Date_current> Date of current record  </Date_current>
    </row>
    I am thinking of using GlobalContainer to store the previous values but am note sure how to maintain these previous values. In addition, I am thinking about using a UDF on the target row record, which will just create the row, if conditions are met (result.addValue("");) and then just make a simple mapping of the ID_target, Score_current_date and Date_current fields and make an other UDF for the Score_yesterday field where I get the Score for the previous record using the GlobalContainer value, that I stored in the other UDF.
    BUT:
    Should I use "All values of context" or "All values of Queues" in the UDF used on the row record and how do I make sure, that the Score_yesterday global container value is maintained correctly? I am planning of setting it in the UDF used on the Target row record but will it then be in sync with the consuming UDF of the Score_yesterday field?
    Java code to go into the UDF would be very much appreciated
    Mikael

    int tmp1;
    int tmp2;
    int len = ID.length;
    for(int i =0;i< len;i++)
         if( i!= len-1)
             tmp1 = Integer.parseInt(Score<i>);
             tmp2 = Integer.parseInt(Score[i+1]);
                   if(tmp2 >tmp1)
                     if (TARGET[0].equals("ROW"))
                              result.addValue("");
                          else if (TARGET[0].equals("ID_TARGET"))
                              result.addValue(ID[0]);
                         else if (TARGET[0].equals("SCORE_YDAY"))
                              result.addValue(Score<i>);
                         else if (TARGET[0].equals("SCORE_CDAY"))
                             result.addValue(Score[i+1]);
                         else
                             result.addValue(DT[i+1]);
    I got the following results for the set of data that you provided.
    Target-XML
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:MT_TestingTGT xmlns:ns0="http://monsanto.com/CIC">
       <Row>
          <ID_TARGET>571515198310502207</ID_TARGET>
          <SCORE_YDAY>1000</SCORE_YDAY>
          <SCORE_CDAY>1010</SCORE_CDAY>
          <CURRENT_DATE>2010-03-02 00:00</CURRENT_DATE>
       </Row>
       <Row>
          <ID_TARGET>571515198310502207</ID_TARGET>
          <SCORE_YDAY>1000</SCORE_YDAY>
          <SCORE_CDAY>1050</SCORE_CDAY>
          <CURRENT_DATE>2010-03-04 00:00</CURRENT_DATE>
       </Row>
       <Row>
          <ID_TARGET>571515198310502207</ID_TARGET>
          <SCORE_YDAY>1050</SCORE_YDAY>
          <SCORE_CDAY>1080</SCORE_CDAY>
          <CURRENT_DATE>2010-03-05 00:00</CURRENT_DATE>
       </Row>
       <Row>
          <ID_TARGET>571515198310502108</ID_TARGET>
          <SCORE_YDAY>2000</SCORE_YDAY>
          <SCORE_CDAY>2040</SCORE_CDAY>
          <CURRENT_DATE>2010-03-03 05:00</CURRENT_DATE>
       </Row>
       <Row>
          <ID_TARGET>571515198310502108</ID_TARGET>
          <SCORE_YDAY>2000</SCORE_YDAY>
          <SCORE_CDAY>2040</SCORE_CDAY>
          <CURRENT_DATE>2010-03-05 05:00</CURRENT_DATE>
       </Row>
       <Row>
          <ID_TARGET>571515198310302203</ID_TARGET>
          <SCORE_YDAY>3000</SCORE_YDAY>
          <SCORE_CDAY>3020</SCORE_CDAY>
          <CURRENT_DATE>2010-03-05 00:00</CURRENT_DATE>
       </Row>
    </ns0:MT_TestingTGT>

  • How to Get Parameter Values from the URL ?

    Hi,
    I have built a calendar called cal_test. I am calling this calendar with this URL:
    http://.../pls/.../xyz.cal_test.show?p_arg_names=p_sc_id&p_arg_values=2&p_arg_names=_start_date&p_arg_values=FEB-2002
    In the 'Additional PL/SQL Code' tab of cal_test, I need to call a procedure which requires me to pass in as parameters the values of p_sc_id and startdate embedded in the URL named above. How can I retrieve these 2 values from the URL ? Any advice will be appreicated !
    Dorothy

    Hi Daniel
    The following thread might help;
    if not, you could try posting the question in Application Server » Web Dynpro Java
    Thanks
    Kenny

  • How to get updated values from the loops while they are running

    Hello,
            I am having difficulty solving a very basic problem, how to access the updated values from the 'FOR loop' while its running?  Basically, the VI  I am currently working on calls two sub VIs. Each sub VI has a for loop, and both VIs may or may not run for same number of iterations. My goal is to read the values at each terminal inside the loop of both sub VIs, in the Main VI. I tried to achieve it using Global Variables, but in main VI it displays only the last iteration value from both sub VIs. Could anyone please tell me whrere am I going wrong? Is there any other/better way to achieve this.
    I appreciate any input on this issue.  
    Kudos are (always) welcome for the good post. :-)
    Solved!
    Go to Solution.

    Dennis,
                In attached VI, I can see the values changing in the sub VI from the main VI with the numeric indicator whose reference is passed on to the sub VI. Now if I wanted to store or use those values how do I do that? I tried to chnge the indicator to control and read from it (in the attached VI) , but the the indicator updates only once. Tried to create a property node and read the Value from it and it didn't work either.
    Thanks in Advance!
    -Nilesh
    Kudos are (always) welcome for the good post. :-)
    Attachments:
    main-1.vi ‏8 KB
    sub-1.vi ‏9 KB

  • How to get multiple values from the db using select

    hi all,
    i am using oracle 9i database
    i created a procedure
    create or replace procedure sample_proce
    as
    to_i varchar2(50)
    begin
    select to_id into to_i from sample where flag in('y');
    dbms_output.put_line('hai'|| to_i);
    end;
    when i executed this procedure the following error occurred.
    error at line 5 fetching too many rows.
    but when i execute the select query alone i can able to view all the rows.
    how to resolve it

    i used the following procedure
    create or replace procedure sample_proc
    as
    begin
    for s in(select to_id from sample where flag='y')
    loop
    dbms_output.put_line(s.to_id);
    end loop.
    end;
    it is executed fine. i can able to fetch all the rows.
    how to pass all these values into the another procedure.
    we usually pass only one value into another procedure, i do no how to pass all the values . please help me.
    Thank u.

  • How to get each value from a parameter passed like this '(25,23,35,1)'

    Hi
    One of the parameter passed to the function is
    FUNCTION f_main_facility(pi_flag_codes VARCHAR2) return gc_result_set AS
    pi_flag_codes will be passed a value in this way '(25,23,35,1)'
    How to get each value from the string
    like 25 first time
    23 second time
    35 third time
    1 fourth time
    I need to build a select query with each value as shown below:-
    (SELECT t2.org_id, t4.description
    from org_name t2, ref_org_name t3, code_table t4
    where t2.att_data = t4.code
    and t3.ref_code = t2.att_type
    and t2.att_type = 25 and t3.code_type = t4.code_type
    and to_date('01-JAN-10', 'DD-MON-YY') between t2.att_start_date AND t2.att_end_date) q1,
    (SELECT t2.org_id, t4.description
    from org_name t2, ref_org_name t3,code_table t4
    where t2.att_data = t4.code
    and t3.ref_code = t2.att_type
    and t2.att_type = 23 and t3.code_type = t4.code_type
    and to_date('01-JAN-10', 'DD-MON-YY') between t2.att_start_date AND t2.att_end_date) q2,
    (SELECT t2.org_id, RTRIM(xmlagg(xmlelement(e, t4.description || ';')
    ORDER BY t4.description).EXTRACT('//text()'), ';') AS DESCRIPTION
    from org_name t2, ref_org_name t3,code_table t4
    where t2.att_data = t4.code
    and t3.ref_code = t2.att_type
    and t2.att_type = 35 and t3.code_type = t4.code_type
    and to_date('01-JAN-10', 'DD-MON-YY') between t2.att_start_date AND t2.att_end_date
    group by t2.org_id) q3,
    (SELECT t2.org_id, t4.description
    from org_name t2, ref_org_name t3, code_table t4
    where t2.att_data = t4.code
    and t3.ref_code = t2.att_type
    and t2.att_type = 1 and t3.code_type = t4.code_type
    and to_date('01-JAN-10', 'DD-MON-YY') between t2.att_start_date AND t2.att_end_date) q4
    Please help me with extracting each alue from the parm '(25,23,35,1)' for the above purpose. Thank You.

    chris227 wrote:
    I would propose the usage of regexp for readibiliy purposes and only in the case if this doesnt perform well, look at solutions using substr etc.
    select
    regexp_substr( '(25,23,35,1)', '\d+', 1, 1) s1
    ,regexp_substr( '(25,23,35,1)', '\d+', 1, 2) s2
    ,regexp_substr( '(25,23,35,1)', '\d+', 1, 3) s3
    ,regexp_substr( '(25,23,35,1)', '\d+', 1, 4) s4
    from dual 
    S1     S2     S3     S4
    "25"     "23"     "35"     "1"In pl/sql you do something like l_val:= regexp_substr( '(25,23,35,1)', '\d+', 1, 1);
    If t2.att_type is type of number you will do:
    t2.att_type= to_number(regexp_substr( '(25,23,35,1)', '\d+', 1, 1))Edited by: chris227 on 01.03.2013 08:00Sir,
    I am using oracle 10g.
    In the process of getting each number from the parm '(25,23,35,1)' , I also need the position of the number
    say 25 is at 1 position.
    23 is at 2
    35 is at 3
    1 is at 4.
    the reason I need that is when I build seperate select for each value, I need to add the query number at the end of the select query.
    Please see the code I wrote for it, But the select query is having error:-
    BEGIN
    IF(pi_flag_codes IS NOT NULL) THEN
    SELECT length(V_CNT) - length(replace(V_CNT,',','')) FROM+ ----> the compiler gives an error for this select query : PLS-00428:
    *(SELECT '(25,23,35,1)' V_CNT  FROM dual);*
    DBMS_OUTPUT.PUT_LINE(V_CNT);
    -- V_CNT := 3;
    FOR L_CNT IN 0..V_CNT LOOP
    if L_CNT=0 then
    V_S_POS:=1;
    V_E_POS:=instr(pi_flag_codes, ',', 1, 1)-1;
    else
    V_S_POS:=instr(pi_flag_codes,',',1,L_CNT)+1;
    V_E_POS:=instr(pi_flag_codes, ',', 1, L_CNT+1)-V_S_POS;
    end if;
    if L_CNT=V_CNT then
    V_ID:=TO_NUMBER(substr(pi_flag_codes,V_S_POS));
    else
    V_ID:=TO_NUMBER(substr(pi_flag_codes,V_S_POS,V_E_POS));
    end if;
    VN_ATYPE := ' t2.att_type = ' || V_ID;
    rec_count := rec_count +1;
    query_no := 'Q' || rec_count;
    Pls help me with fetching each value to build the where cond of the select query along with the query number.
    Thank You.

  • How to select multiple values from the parameters in BI Publisher report

    How to select multiple values from the parameter drop down in BI Publisher, and how to handle this mulitple values from the report sql...

    Hi kishore,
    I have used all the steps as you mentioned in your previous reply....including checking Mulitple Selection Check Box..
    Iam able to get the results when I am selecting one value..
    and also I am able to handle multiple values the in the query by using IN :Parameter, but seems when we select more than one value from the parameter drop down i think the Bi Publisher is sending the values in concatenated form something ilke
    ex: "'ACCOUNT','HR','SALES'" ,and when trying to display the parameters values in the output, its throwing the error as 'missing right paranthesis' ....on the whole do you have any solution which would handle
    1.Single selection.
    2.Multiple selection.
    3.'ALL' Values.
    4.Separating the concatenated string into individual strings and dispaly them on the output of the report..etc..in case of Mulitple selection.
    Ex:
    Concatenated String from BI Publisher:"'ACCOUNT','HR','SALES'"
    Expected Output on the report:ACCOUNT,HR,SALES
    reply to this would be much appreciated....
    thanks,
    manoj

  • How to get selected value from selectOneRadio ???

    Hi...i want to how to get selected value from selectOneRadio and use it in another page and in backing bean.
    Note i have about 10 selectOneRadio group in one page i want to know value of each one of them.
    Plzzzzzzzz i need help

    You have a datatable in which each row is a question, correct?
    Also in each row you have 5 possible answers that are in a radio, correct?
    So,
    You need to put in your datatable model, a question, and a list of answers (5 in yor case) and the selected one.
    So you will have a get to the question, an SelectItem[] list to populate the radios and another get/set to the selected question.
    ex:
    <h:selectOneRadio value="#{notas.selectedString}" id="rb">
    <f:selectItem itemValue="#{notas.valuesList}"/>
    </h:selectOneRadio>
    Search the web for examples like yours.

  • How to get column value from DB grid

    Hi!
    I wander how to get col value from GridControl?
    My app consists of one rowsetinfo with two
    columns CODE and DESCRIPTION and a jbutton
    titled SELECT. When user clicks SELECT button
    the app should show the value of the CODE col
    of the selected row in GridControl.
    I wander how to make this action ?
    XxpsTransTimesMasterIter.setAttributeInfo( new AttributeInfo[] {
    CODEXxpsTransTimesMasterIter,
    DESCRIPTIONXxpsTransTimesMasterIter} );
    XxpsTransTimesMasterIter.setName("XxpsTransTimes");
    XxpsTransTimesMasterIter.setQueryInfo(new QueryInfo(
    "XxpsTransTimesMasterIterViewUsage",
    "lov.XxpsTransTimes",
    "CODE, DESCRIPTION",
    "XXPS_TRANS_TIMES",
    null,
    null
    ));

    Hi,
    You could attach an ActionListener on the JButton, and try the following code :
    NavigationManager fm = NavigationManager.getNavigationManager();
    DataItem dataItem = fm.getFocusedControl().getDataItem();
    ImmediateAccess col_code = null;
    String code = null;
    if (dataItem != null && dataItem instanceof RowsetAccess) {
    RowsetAccess rowset = (RowsetAccess)dataItem;
    try {
    col_code = (ImmediateAccess) rowset.getColumnItem("CODE");
    code = col_code.getValueAsString();
    } catch (DuplicateColumnException de) {
    return;
    } catch (ColumnNotFoundException ce) {
    return;
    } catch (SQLException se) {
    return;
    JTextField tf = new JtextField();
    tf.setText(code);
    I haven't tested this code.
    I am curious to know, the Object type of the dataItem.If it doesnot happen to be RowsetAccess ..try.. ScrollableRowsetAccess OR ImmediateAccess.
    Your code would change accordingly, depending on the instance.Refer to the product documentation for this.
    Do let me know, if this works.
    TIA
    Sandeep

  • How to get string value from xml in JSF??

    In JSF How to get string value from xml, .ini and properties file. I want to get string value from xml or text to JSF

    Just use the appropriate API's for that. There are enough API's out which can read/parse/write XML, ini and properties files. E.g. JAXP or DOM4J for xml files, INI4J for ini files and Sun's own java.util.Properties for propertiesfiles.
    JSF supports properties files as message bundle and resource bundle so that you can use them for error messages and/or localization.

  • How to get selected value from OADefaultListBean.

    Hi All,
    How to get selected value from OADefaultListBean ?
    Thanks,

    Hi,
    To identify the user's selection(s) when the page is submitted, you would add the following logic to your processFormRequest() method:
    OADefaultListBean list =
    (OADefaultListBean)webBean.findChildRecursive("positionsList");
    String name = list.getName();
    String[] selectedValues = pageContext.getParameterValues(name);
    To retrieve all the values in the list box, call list.getOptionsData().
    --Prasanna                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to get attribute value from standard page ?

    Hi,
    How to get attribute value from standard page ?
    String str = (String)vo.getCurrentRow().getAttrbute("RunId");
    But this value is returning a null value ....
    Can anyone help me to get this attribute value which is actually having a actual value .

    getCurrentRow() would always return null if no setCurrentRow() is used.
    Please check the page design and understand how many rows of VO are there. You can also use the following to get the row:
    vo.reset();
    vo.next();
    Regards
    Sumit

  • How to get real value from selectOneChoice with javascript?

    Hi,
    How to get real value from selectOneChoice with javascript? The event.getNewValue() only gets me the index of the selected item, not the value/title.
    JSF page:
    <af:resource type="javascript">
    function parseAddress(event)
    alert("new value: " + event.getNewValue());
    </af:resource>
    <af:selectOneChoice label="Location:" value="" id="soc4">
    <af:clientListener type="valueChange" method="parseAddress" />
    <f:selectItems value="#{Person.locations}" id="si7"/>
    </af:selectOneChoice>
    HTML :
    <option title="225 Broadway, New York, NY-10007" selected="" value="0">225 Broadway (Central Office)</option>
    <option title="90 Mark St., New York, NY-10007" value="1">90 Mark St. (Central Office)</option>
    Thanks a lot.

    Something I was missing ,
    You need to add valuePassThru="true" in your <af:selectOneChoice component. I have personally tested it and got the actual value in alert box. I hope this time you got the real solution. You can also test the following code by your end.
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
    <jsp:directive.page contentType="text/html;charset=UTF-8"/>
    <f:view>
    <af:document id="d1">
    <af:form id="f1">
    <af:panelBox text="PanelBox1" id="pb1">
    <af:selectOneChoice label="Set Log Level" id="soc1"
    value="#{SelectManagedBean.loggerDefault}"
    valuePassThru="true">
    <af:selectItem label="select one" value="First" id="s6"/>
    <af:selectItem label="select two" value="Second" id="s56"/>
    <af:clientListener method="setLogLevel" type="valueChange"/>
    </af:selectOneChoice>
    <af:resource type="javascript">
    function setLogLevel(evt) {
    var selectOneChoice = evt.getSource();
    var logLevel = selectOneChoice.getSubmittedValue();
    // var logLevelObject = AdfLogger.NONE;
    alert("new value is : " + logLevel);
    //alert(evt.getSelection);
    //alert(logLevelObject);
    evt.cancel();
    </af:resource>
    </af:panelBox>
    </af:form>
    </af:document>
    </f:view>
    </jsp:root>

Maybe you are looking for