Format XML doc based on values in another xml doc

Database version : Oracle 10g
I have an XML "data" file and an associated error file that is also XML. I want to take the XML data file and highlight visually in a html file only those fields and contents that are there in the "error" file.
There are many fields in the data file so the error could be just about anywhere. Can someone please tell me what I should read or give me some direction on how I should proceed?
I built a style sheet for the "data" file - but obviously that is static. Do i need 2 stylesheets and apply them both somehow? I was also thinking that I would use the "error" xml doc and just rewrite the error nodes in the "data" file and then use the style sheet to mark up the data file based on what i rewrite.
eg
if the data is say
<field1>content of field 1</field1>
and the error file has field1 in it, I would rewrite the data file to have say <error>content of field 1</error> and just mark up the <error> using the stylesheet. Is that a sensible solution? Even then I need help on the actual xml/sql functions i need to rewrite the xml data.
I am a rank beginner in this and I apologize - This seems such a newbie question that must have been asked before - I just wish I could find it in the forum.
Thank you!
Edited by: user13112667 on Oct 15, 2010 12:38 PM

Thanks for the samples.
A couple of options I can think of :
- XSL transformation (as you first thought of too)
- XQuery
Below is a test script that implements both solutions :
DECLARE
datadoc xmltype := xmltype(
'<HII>
<HII_SEQ_NUM>6084997</HII_SEQ_NUM>
<HII_RECORD_ID>HII</HII_RECORD_ID>
<HII_DOC_TYPE>INV</HII_DOC_TYPE>
<HII_WSLR_ID>XXXXX</HII_WSLR_ID>
<HII_WSLR_ABBR>COM</HII_WSLR_ABBR>
<HII_CUST_NBR>096636</HII_CUST_NBR>
<HII_INV_DATE>100203</HII_INV_DATE>
<HII_INV_NUMB>829608-1102</HII_INV_NUMB>
<HII_ORD_NUMB>830412</HII_ORD_NUMB>
<HII_TP_ID>007839602</HII_TP_ID>
<HII_WSLR_DUNS>000073669</HII_WSLR_DUNS>
<HII_TRANS_TYPE>DI</HII_TRANS_TYPE>
<HII_CAVN_ID>77873</HII_CAVN_ID>
<HII_VER_NUM>22</HII_VER_NUM>
</HII>'
errordoc xmltype := xmltype(
'<document>
<error>
<segment>HII</segment>
<element>HII_INV_DATE(Inv Date)</element>
<msg>Invoice date must be in the format yyyymmdd</msg>
<data>100203</data>
</error>
<error>
<segment>HII</segment>
<element>HII_TP_ID(TP ID)</element>
<msg>Data must be 12 digits long</msg>
<data>007839602</data>
</error>
</document>'
xsldoc xmltype := xmltype(
'<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" version="4.0"/>
<xsl:template match="/">
<HTML>
  <BODY>
   <STYLE type="text/css">
    <![CDATA[
    TR.err { background-color: red }
    TD { border: 1px solid }
    TABLE { border-collapse: collapse }
    ]]>
   </STYLE>
   <TABLE>
   <xsl:apply-templates select="root/datafile/HII/*"/>
   </TABLE>
  </BODY>
</HTML>
</xsl:template>
<xsl:template match="HII/*">
<xsl:variable name="msg" select="/root/errorfile/document/error[segment=name(current()/..) and substring-before(element,''('')=name(current())]/msg"/>
<TR>
  <xsl:if test="$msg"><xsl:attribute name="class">err</xsl:attribute></xsl:if>
  <TD><xsl:value-of select="name(.)"/></TD>
  <TD><xsl:value-of select="."/></TD>
  <TD><xsl:value-of select="$msg"/></TD>
</TR>
</xsl:template>
</xsl:stylesheet>'
html_res1 clob;
html_res2 clob;
BEGIN
-- XSL Transformation
SELECT XMLTransform(
  xmlelement("root",
   xmlconcat( xmlelement("datafile",datadoc),
              xmlelement("errorfile",errordoc) )
  xsldoc
).getClobVal()
INTO html_res1
FROM dual;
-- XQuery
SELECT XMLQuery(
  '<HTML>
    <BODY>
     <STYLE type="text/css">
      TR.err {{ background-color: red }}
      TD {{ border: 1px solid }}
      TABLE {{ border-collapse: collapse }}
     </STYLE>
     <TABLE>
      for $i in $d/HII/*
      let $n := name($i)
      let $v := $i/text()
      let $msg := xs:string($e/document/error[segment=name($i/..) and substring-before(element,"(")=$n]/msg)
      return
        element TR {
          if ($msg) then
            attribute class {"err"}
          else (),
          <TD>{$n}</TD>,
          <TD>{$v}</TD>,
          <TD>{ $msg }</TD>
     </TABLE>
    </BODY>
   </HTML>'
  passing datadoc as "d",
          errordoc as "e"
  returning content
).getClobVal()
INTO html_res2
FROM dual;
END;
/Same principle for the two methods : looping through the data document and searching for a matching occurrence in the error document using XPath.
It produces an HTML document (html_res1 and html_res2) like this :
<HTML>
<BODY>
  <STYLE type="text/css">
    TR.err { background-color: red }
    TD { border: 1px solid }
    TABLE { border-collapse: collapse }
    </STYLE>
  <TABLE>
   <TR>
    <TD>HII_SEQ_NUM</TD>
    <TD>6084997</TD>
    <TD></TD>
   </TR>
   <TR>
    <TD>HII_RECORD_ID</TD>
    <TD>HII</TD>
    <TD></TD>
   </TR>
   <TR>
    <TD>HII_DOC_TYPE</TD>
    <TD>INV</TD>
    <TD></TD>
   </TR>
   <TR>
    <TD>HII_WSLR_ID</TD>
    <TD>XXXXX</TD>
    <TD></TD>
   </TR>
   <TR>
    <TD>HII_WSLR_ABBR</TD>
    <TD>COM</TD>
    <TD></TD>
   </TR>
   <TR>
    <TD>HII_CUST_NBR</TD>
    <TD>096636</TD>
    <TD></TD>
   </TR>
   <TR class="err">
    <TD>HII_INV_DATE</TD>
    <TD>100203</TD>
    <TD>Invoice date must be in the format yyyymmdd</TD>
   </TR>
   <TR>
    <TD>HII_INV_NUMB</TD>
    <TD>829608-1102</TD>
    <TD></TD>
   </TR>
   <TR>
    <TD>HII_ORD_NUMB</TD>
    <TD>830412</TD>
    <TD></TD>
   </TR>
   <TR class="err">
    <TD>HII_TP_ID</TD>
    <TD>007839602</TD>
    <TD>Data must be 12 digits long</TD>
   </TR>
   <TR>
    <TD>HII_WSLR_DUNS</TD>
    <TD>000073669</TD>
    <TD></TD>
   </TR>
   <TR>
    <TD>HII_TRANS_TYPE</TD>
    <TD>DI</TD>
    <TD></TD>
   </TR>
   <TR>
    <TD>HII_CAVN_ID</TD>
    <TD>77873</TD>
    <TD></TD>
   </TR>
   <TR>
    <TD>HII_VER_NUM</TD>
    <TD>22</TD>
    <TD></TD>
   </TR>
  </TABLE>
</BODY>
</HTML>Performance-wise, you'll have to test on real documents, but I think XSLT is better.

Similar Messages

  • How to create a new row for a VO based on values from another VO?

    Hi, experts.
    in jdev 11.1.2.3,
    How to create a new row for VO1 based on values from another VO2 in the same page?
    and in my use case it's preferable to do this from the UI rather than from business logic layer(EO).
    Also I have read Frank Nimphius' following blog,but in his example the source VO and the destination VO are the same.
    How-to declaratively create new table rows based on existing row content (20-NOV-2008)
    http://www.oracle.com/technetwork/developer-tools/adf/learnmore/13-create-with-params-169140.pdf
    I have tried:
    1.VO1(id,amount,remark1) and VO2(id,amount,remark2) are based on different EO,but render in same page,
    2.Drag and drop a Createwithparams button for VO1(id,amount,remark),
    3.add: Create insertinside Createwithparams->Nameddata(amount),
    4.set NDName:amount, NDValue:#{bindings.VO2.children.Amount}, NDtype:oracle.jbo.domain.Number.
    On running,when press button Createwithparams, cannot create a new row for VO1, and get error msg:
    <Utils> <buildFacesMessage> ADF: Adding the following JSF error message: For input string: "Amount"
    java.lang.NumberFormatException: For input string: "Amount"
         at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
    Can anyone give some suggestions?
    Thanks in advance.
    bao
    Edited by: user6715237 on 2013-4-19 下午9:29

    Hi,CM,
    I'm really very appreciated for your quick reply! You know, today is Saturday, it's not a day for everyone at work.
    My principal requirement is as follows:
    1.select/check some rows from VO2, and for each selection create a new row with some attributes from VO2 as default values for VO1's corresponding attributes, and during this process the user may be cancel/uncheck or redo some of the selections.
    --so it's better to implement it in UI rather than in EO.
    2.it's better to implement this function with declarative way as in Frank Nimphius' blog.
    --little Jave/JS coding, the better. I only have experience in ORACLE FORMS, little experience in JAVA/JS.
    In order to get full information for the requirements of my use case, can take a check at:
    How to set default value for a VO query bind variable in a jspx page?
    (the end half of the thread: I have a more realworld requirement similar to the above requirement is:
    Manage bank transactions for clients. and give invoices to clients according to their transaction records. One invoice can contain one or many transactions records. and one transaction records can be split into many invoices.
    Regards
    bao
    Edited by: user6715237 on 2013-4-19 下午11:18
    JAVE->JAVA

  • Color a column based on value in another column in tableview

    I am using a tableview iterator to display data in a bsp page. I want to color a cell in particular column (column 4), when a value in another column (column 2) on that same row is greater than 20. I can color the cell in column 2 but am not able to color the cell in column 4. How can I accomplish this?
    This is what I have. Looks like val1 is losing it's value.
    CASE p_column_index.
        WHEN 2.
          ASSIGN p_row_data_ref->* TO <row>.
          ASSIGN COMPONENT 'ZTGT' OF STRUCTURE <row> TO <col>.
          VAL = <col>.
          IF VAL GT '20'.
            val1 = p_row_index.
            p_style = 'celldesign:CRITICALVALUE_DARK'.
          ENDIF.
        WHEN 4.
            if p_row_index = val1.
              p_style = 'celldesign:CRITICALVALUE_DARK'.
            endif.
        WHEN OTHERS.
    do nothing
      ENDCASE.

    The reason val1 is "loosing its' value" is presumably because you have defined it in the method as a local variable. So each time you call the RENDER_CELL_START method it is is newly initialised. So if you make this an instance attribute it will retain its' contents across method calls.
    Cheers
    Graham Robbo

  • Refreshing sql report region based on values from another region - 4.0

    Greetings All,
    I have a page with two regions, say region 1 and region 2. I have a before header process that fetches values from db based on criteria entered from another page. Region 2 is a sql report region with bind variables from region 1. When this page is rendered region 1 renders properly however sql report region always returns no records. What am i missing here?
    I would like to have the region 2 render a report based on the values from region 1. Region 2 has a sql query that looks something like
    select
    colum 1,
    column 2,
    column 3
    from table t1
    where t1.c1 = :p10_item1
    and t1.c2 = :p10_item2Using apex 4.0
    thanks
    Seetharaman

    If these items hidden, try making them display only .
    Also what happens when you move the items from region 1 to region 2.
    From my experience items do not have much of a dependency on the region they are attached to other than cases when the region is not rendered(when its condition fails) and then the item values become null(bcoz they themselves are not rendered).

  • Insert value into a column based on value of another column

    Hi,
    I am trying to insert a value into a record based on a column in
    the record, using a trigger. The complication arises because
    the new value is selected from the same table. For example:
    SELECT COL1, COL2, COL3, COL4 from TABLE1
    I want to set COL2 and COL3 based on the value of COL4. And to
    get the value of COL2 and COL3, I will go back to TABLE1 and set
    the condition to TABLE1.COL1 = :NEW.COL4
    I cannot seem to execute the trigger as I get the message "ORA-
    04091: table SYSTEM.TABLE1 is mutating, trigger/function may not
    see it" everytime.
    Is this the correct way to achieve what I wanted? Or is there
    another way?
    Appreciate your feedback. Thank you in advance.

    Hi,
    I am trying to insert a value into a record based on a column in
    the record, using a trigger. The complication arises because
    the new value is selected from the same table. For example:
    SELECT COL1, COL2, COL3, COL4 from TABLE1
    I want to set COL2 and COL3 based on the value of COL4. And to
    get the value of COL2 and COL3, I will go back to TABLE1 and set
    the condition to TABLE1.COL1 = :NEW.COL4
    I cannot seem to execute the trigger as I get the message "ORA-
    04091: table SYSTEM.TABLE1 is mutating, trigger/function may not
    see it" everytime.
    Is this the correct way to achieve what I wanted? Or is there
    another way?
    Appreciate your feedback. Thank you in advance. I'm not sure what you mean when you insert a value into a
    record, but if you are setting a value in a column of the same
    record using a trigger, then it's easy.
    :new.COL2 := ....:new.COL4...
    :new.COL3 := ....:new.COL4...
    The trigger must be 'INSERT or UPDATE' and 'FOR EACH RECORD'.
    If you are setting a different record in the same table, the
    solution is much more difficult.

  • Conditional inclusion of column cells based on value in another column?

    I was wondering if something like the following is possible -- I've looked through the forums and Numbers user guide but can't figure it out:
    Suppose I have a column A of sales figures, and columns B and C which basically have different attributes (say, color (yellow or green), size (small or large), and material (cotton or polyester)).
    I want to run basic statistics on various combinations: e.g. all yellow items regardless of size, all green cotton items regardless of size, all large yellow items regardless of material, etc.
    I want to be able to specify something like this:
    'Compute the average of every cell in column A where column B=="green" and column C=="large"'
    Is there a good way to go about doing this? Would I want to attack the problem using categories, sorting, and multiple tables? Or is there a way to conditionally include cell values from a range based on the value of that row's cell in another column?
    Thanks for any help.

    All I can think of to solve the quartile and median functions is to have another table of the same size as your original table that gets populated with just the items that match. Then you can do the quartile and median (and average) on that table. It's a one-at-a-time affair; you can only do one selection of size, color, and/or material at a time but you can get the median, mean, and quartiles of it. Of course, you could have multiple copies of this second table if you want to do more than one comparison at a time.
    In the attached file, unhide the hidden rows in Table 2 to see the formulas that do all the work.
    [files.me.com/pwb3/6hobt0.numbers.zip]
    Message was edited by: Badunit
    Message was edited by: Badunit

  • Inserting values in atable based on values in another table

    Hi,
    We receive data from our customers as follows AB784589456. This is the starting value for an serial number of a product. We also receive a quantity. I need to be able to populate rows in another table to start with AB784589456 and then add an additional
    row to the value of the quantity. So the first row in the second table would be AB784589456, the second AB784589457, AB784589458, etc until the number has been incremented to the value of the quantity.
    Order Number     SerialNo
    234                     AB784589456
    234                     AB784589457
    234                     AB784589458
    The datatype of the SerialNo is Varchar(14)
    Any help would be appreciated
    Thanks

    Assuming the serial value format is consistent ie alphabet followed by numeric you can use this
    DECLARE @Serial varchar(14) = 'AB784589456', @Quantity int = 15
    ;With N1
    AS
    SELECT 1 N UNION ALL SELECT 1 UNION ALL SELECT 1
    ),N2
    AS
    SELECT 1 N FROM N1 t1 CROSS JOIN N1 t2
    ),N3
    AS
    SELECT 1 N FROM N2 t1 CROSS JOIN N2 t2 CROSS JOIN N2 t3
    ),N4
    AS
    (SELECT ROW_NUMBER() OVER (ORDER BY (SELECT 1)) AS Seq
    FROM N3
    INSERT INTO YourTable (OrderNumber,SerialNo)
    SELECT OrderNumber,LEFT(@Serial,PATINDEX('%[0-9]%',@Serial)-1) + CAST(STUFF(@Serial,1,PATINDEX('%[0-9]%',@Serial)-1,'') + Seq -1 AS varchar(11))
    FROM Table1 t
    CROSS JOIN N4 n
    WHERE n.Seq BETWEEN 1 AND @Quantity
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Conditionally set page item based on value of another item

    Hello,
    I have a form that is used to create/apply changes to records. There is an application item (APP_ITEM_PROFILE)
    that is set on login which contains a value for the user's Profile ID. This Profile ID is used through out the
    application for authorizations (conditionally present tabs, etc).
    I've set a page item on the form equal to APP_ITEM_PROFILE so that the record is stamped
    with that user's profile ID when they create a record. Users with different Profile IDs may later make changes to
    the record but I want to keep the original Profile_ID on the record.
    I am trying to populate the Profile ID conditionally in the form based on the existence of a
    record ID. If there is no ID (a new record is being entered), then I want the
    Profile ID to be that of the current user (APP_ITEM_PROFILE). If there is an ID (modification is
    being made to an existing record), then I want the keep the Profile ID that was originally saved
    with the record in MyTable.
    I have this as the source for :P11_PROFILE_ID. The type is PL/SQL Expression or Function, Always, replacing... but it
    is not working (page not found when page is run):
    begin
    if :P11_ID is not null
    then
    select PROFILE_ID
    into :P11_PROFILE_ID
    from MyTable
    where ID = :P11_ID;
    elsif :P11_ID is null
    then select nv(':APP_ITEM_PROFILE') into :P11_PROFILE_ID from dual;
    end if;
    end;
    Item Descriptions:
    ID is the record ID.
    :P11_ID is the page item of the record ID (Display as Text, saves state).
    PROFILE_ID is the user's Profile ID.
    :P11_PROFILE_ID     is the page item of the user's Profile ID.
    :APP_ITEM_PROFILE is the user's Profile ID that is set on login.
    Any help is greatly appreciated.
    Thanks,
    Matt
    Update:
    I found one of Scott's answers:
    Using IF Else to determine the value of a Item
    and modified the above code to:
    declare l_ret number;
    begin
    if :P11_ID is not null
    then
    select PROFILE_ID
    into l_ret
    from MyTable
    where ID = :P11_ID;
    else select :APP_ITEM_PROFILE' into l_ret from dual;
    end if;
    return l_ret;
    end;
    It seems to be setting the Profile ID correctly when the ID is not null, but not when a new record is being created. In the latter case, there is no value.
    Edited by: mterlesky on May 11, 2009 11:02 PM
    Edited by: mterlesky on May 11, 2009 11:52 PM
    Edited by: mterlesky on May 11, 2009 11:53 PM

    Thanks. That is putting the value into the page item and session state but that value is not being saved when the record is created. I'm not sure why - here is part of the debug (the "Billing" table is the "MyTable" table in the previous posting). Any thoughts?
    On form, before submit:
    0.06: Saving g_arg_names=P11_PROFILE_ID and g_arg_values=112
    0.06: ...Session State: Saved Item "P11_PROFILE_ID" New Value="112"
    After Submit
    0.06: ...Session State: Save "P11_PROFILE_ID" - saving same value: "112"
    (validations not shown)
    0.10: Processing point: AFTER_SUBMIT
    0.10: ...Process "Get PK": PLSQL (AFTER_SUBMIT) declare function get_pk return varchar2 is begin for c1 in (select BILLING_SEQ.nextval next_val from dual) loop return c1.next_val; end loop; end; begin :P11_ID := get_pk; end;
    0.10: ...Session State: Save Item "P11_ID" newValue="452" "escape_on_input="Y"
    0.10: ...Do not run process "Get PK for CREATEAGAIN", process point=AFTER_SUBMIT, condition type=, when button pressed=CREATEAGAIN
    0.10: ...Process "Process Row of BILLING": DML_PROCESS_ROW (AFTER_SUBMIT) #OWNER#:BILLING:P11_ID:ID|IUD
    0.10: ...Process "Update TOTAL_HOURS": PLSQL (AFTER_SUBMIT) begin Update billing set TOTAL_HOURS = ((NVL(CD_90801_UNITS,0)*1.5)+ (NVL(CD_90804_UNITS_B,0)*.5)+ NVL(CD_90806_UNITS,0)+ (NVL(CD_90808_UNITS_B,0)*1.5)+ NVL(CD_90812_UNITS,0)+ (NVL(CD_90814_UNITS_B,0)*1.5)+ NVL(CD_90846_UNITS,0)+ NVL(CD_90847_UNITS,0)+ NV
    0.11: ...Process "Update TOTAL_UNITS": PLSQL (AFTER_SUBMIT) begin Update billing set TOTAL_UNITS = (NVL(CD_90801_UNITS,0)+ NVL(CD_90804_UNITS_B,0)+ NVL(CD_90806_UNITS,0)+ NVL(CD_90808_UNITS_B,0)+ NVL(CD_90812_UNITS,0)+ NVL(CD_90814_UNITS_B,0)+ NVL(CD_90846_UNITS,0)+ NVL(CD_90847_UNITS,0)+ NVL(CD_90853_UNITS,0)+ NV
    0.11: ...Process "G_TRANS_COUNT_ADD": PLSQL (AFTER_SUBMIT) begin :G_TRANS_COUNT := :G_TRANS_COUNT +1; end;
    0.11: ...Session State: Saved Item "G_TRANS_COUNT" New Value="1"
    0.11: ...Process "Email_Notification": PLSQL (AFTER_SUBMIT) declare l_body_html varchar2(4000); begin l_body_html := '<p>Billing ID '||:P11_ID||' was entered by '||:P11_PROV_NAME||'.'|| ' More transactions may have been entered by the provider after this one.'||'</p> <p><a
    Edited by: mterlesky on May 12, 2009 9:21 AM

  • How to display f4 help for a field based on value of another field

    Hello All,
    I have 4 fields : Sales Org : VBAK-VKORG, Distrib Channel : RV50A-VTWEG, Div : RV50A-SPART, Sold-to-party : KUAGV-KUNNR.
    The second field depends on the first one, the third on the second one and the fourth on the first field.
    However, when each of the second third and fourth fields' f4 help is displayed, the values are independent of the previous fields. How do I set the f4 help to display values based on the respective fields?
    Regards,
    Mithun

    Please be sure that you are searching the forums before posting. This exact same question was asked just yesterday:
    F4 help to input field
    In particular study the section and the linked help document for ddic search helps export/importing parameters and the requirements for DDic Structure/table usage for the parameter mapping.

  • Change LOV of column in view, based on values of another LOV of column in the same view

    Hi,
    I am using Jdeveloper 11.1.1.5.
    I have a scenario in which I have two columns in the view. column names are:
    1- Column A
    2- Column B
                        both the columns have LOV's
    LOV in column A contains values as: 1, 2. Now, when I select the value 1 in column A, In the column B, an LOV named ABC should be shown. and when I select value 2 from LOV in column A,  LOV named XYZ should be shown in column B.
    how can I do that?
    thanks in advance (^.^).

    Use onchange attribute of the first drop-down. On change, submit the form. On server side, fetch the values for second drop-down based on the value selected for the first drop-down.

  • Averaging selected range based on value of another channel

    I have one channel, X, with a bunch of integer values from 0 to 90. I also have another channel with various corresponding data, lets call it Y. I would like to find the average and standard deviation for all of the values in Y that have a 0 in its corresponding X row, then the same for all values in Y that have a 1 in its corresponding row and etc, all the way up to 90. Is there an easy way to do this? Perhaps there is a way to sort the data and put all the Y values into new channels that are grouped according to their X values?

    Hi Martin,
    You have a couple of options.  You could indeed use the FormulaCalc() command to split out various rows from your data channel that all have the same index into a new data channel and do this for each index.  Alternatively, you could determine which rows contain a certain index, then use the StatBlockCalc() function to determine statistics from only these rows of your data channel:
    Dim Channel, Msg
    Channel = "[1]/Time"
    For i = 1 To 22
      StatSel(i) = "No"
    Next
    StatSel(4)  = "Yes" ' Minimum
    StatSel(5)  = "Yes" ' Maximum
    StatSel(6)  = "Yes" ' Arith. mean
    StatSel(14) = "Yes" ' Standard Deviation
    Call StatBlockCalc("Channel", "1-13", Channel)
    Msg = Msg & "Min = " & StatMin        & vbCRLF
    Msg = Msg & "Ave = " & StatArithMean  & vbCRLF
    Msg = Msg & "Max = " & StatMax        & vbCRLF
    Msg = Msg & "Dev = " & StatDeviation
    MsgBox Msg
    Note that if you have DIAdem 10.1 you should loop up to 23,
    Brad Turpin
    DIAdem Product Support Engineer
    National Instruments

  • Remove xml node based on value

    Hi,
    we have to remove elements bases on the value.
    for example consider below xml
    <htl:room>
              <htl:ratePlan>
                <htl:freeNights>12</htl:freeNights>
                <htl:promoSavings>undefined</htl:promoSavings>
                <htl:tax>undefined</htl:tax>
              </htl:ratePlan>
              <htl:guestAllocation>1,2</htl:guestAllocation>
            </htl:room>
    We have to remove elements with value undefined and should construct a new xml as below
    <htl:room>
              <htl:ratePlan>
                <htl:freeNights>12</htl:freeNights>
              </htl:ratePlan>
              <htl:guestAllocation>1,2</htl:guestAllocation>
            </htl:room>
    please help.
    Thanks

    i assume that loc always corresponds to name. So to find the rows to remain is just a simple group by
    with data as(
    select 'aaa' name,'a1' loc,10 count from dual union all
    select 'aaa','a1',0 from dual union all
    select 'bbb','b1',0 from dual union all
    select 'ccc','c1',0 from dual union all
    select 'dcc','d1',11 from dual union all
    select 'dcc','d1',0 from dual )
    select
      name
    , loc
    , max(count) cnt
    from data
    group by
      name
    , loc
    order by
      name
    , loc
    NAME     LOC     CNT
    aaa     a1     10
    bbb     b1     0
    ccc     c1     0
    dcc     d1     11to find the other is just a minus
    with data as(
    select 'aaa' name,'a1' loc,10 count from dual union all
    select 'aaa','a1',0 from dual union all
    select 'bbb','b1',0 from dual union all
    select 'ccc','c1',0 from dual union all
    select 'dcc','d1',11 from dual union all
    select 'dcc','d1',0 from dual )
    select name,loc,count from data
    minus
    select
      name
    , loc
    , max(count) cnt
    from data
    group by
      name
    , loc
    order by
      name
    , loc
    NAME     LOC     COUNT
    aaa     a1     0
    dcc     d1     0so a delete would be
    delete from data
    where
    (name,loc,count)
    in
    (select name,loc,count from data
    minus ..regards

  • Updating a field on one screen based on values in another screen

    We have defined a new screen (ccalled Customer Data) for the Business Partner transaton BP.
    On this screen is a new field that has been defined and appended to BUT000. The field is a kind of customer GUID that allocates a unique ID string to a customer (we call it a matchcode, not to be confused with the SAP standard meaning).
    The value in the field is calculated by a function module, which needs uses some of the address data on the standard address tab of the BP transaction. If that data on the address screen changes, then the following needs to happen:
    1) The matchcode field on the Customer Data screen needs to be updated.
    2) When saved, the new matchcode is updated to the database (not a problem if the matchcode is recalcuated on the Customer Data screen).
    Here are the questions:
    1) How can I access the updated data on the address screen in the Customer Data screen? I was under the impression that the funtion modules which respond to events on each page are in their own function groups, so I cannot see the changed data from any function module bound to the Customer Data screen events. Is that true?
    2) How could I access the changed data on the address screen to re-calculate the matchcode field?
    BR,
    Tony.

    Closed; I spent a lot of time analysing this.Answer I think is no.
    1) No guarantee of the order in which the screens are processed (DSAVE event for addresses is after DSAVE for custom screen, so scratch that).
    2) Data exists in separate memory areas for separate screens and needs to be passed by EXPORT/IMPORT. 1) prevents this.

  • Select LOV based on value in another table

    Hi all,
    I have an issue,
    I have an item with Select list with dynamic query in the dropdown ListofValues.
    but i want to use a condition like
    select val1 display_value val2 return_value
    from table2
    where value_in_table1 = username AND table_id1=table_id2
    in these two tables i have the id's common and table 1 is having the usernames.
    Can somebody help me in solving this issue please.
    Thanks in advance

    As far as I know, you can't dump PL/SQL into the list of values definition. Try just having select distinct PJT_NAME display_value, PROJECT_ID return_value from EZS_PROJECTS WHERE EMP_ID = :P1_XYZ ORDER BY 1

  • Find/Replace text in one Doc based on List from another Doc

    I'm not sure Automator can do this so I thought I would ask before spending too much time on it. I have searched the forums and several of the Automator tutorial websites.
    What I want to do is take one text file (or it could be an Excel file, I don't care) with a list of words to Find in a folder full of files.
    For example I have this list in a txt file:
    Big Dog
    Furry Cat
    Bird
    Fox
    I would want the action to search every document for every occurrence of 'Big Dog', then search for every occurrence of 'Furry Cat', etc. I would also want to replace each instance with something else, say a formatted html link.
    Is something like that even possible with Automator? I am on Snow Leopard but I didn't see a forum for Automator on SL. Thanks in advance for any help/advice.

    Asked and responded here:
    http://discussions.apple.com/thread.jspa?messageID=8367522
    Yvan KOENIG (from FRANCE vendredi 14 novembre 2008 14:22:47)

Maybe you are looking for