Regular Expression & LEVEL - how to split attribut value

Hi Folks;
I have to transform the value of an attibut Attr_A (of table A) in multiple attibut's values in a another table B like that :
Table A
Attr_A = '[only one letter from A to Z][only 5 numerics from 0 to 9][space][Operator][space][only one letter from A to Z][only 5 numerics from 0 to 9][space][Operator][space][only one letter from A to Z][only 5 numerics from 0 to 9][space][Operator][space]etc...
with Operator = 'AND' or '(+),' or '(-),'
exemple Attr_A='L12345 AND T23456 (+), U12345 (-)'
In the result table B, I would have :
- first column egal to 'L12345'
- secund column egal to '1' (position of the first column value in the Attr_A)
- third column egal to 'AND'(the operator between secund column value of table B)
Next record :
- first column egal to 'T23456'
- secund to '2'
- third to '(+),'
etc 'U12345' '3' '(-),'
Thanks for your help ^^
Edited by: Moostiq on 27 avr. 2011 10:54
Edited by: Moostiq on 27 avr. 2011 10:54

Hi,
Whenever you post code or data on this this, please format it and type hese 6 characters:
\(small letters only, inside curly brackets) before and after each section of formatted text.  This will keep strings such as (+)
from looking like
(+)
You need to divide attr_a into parts, where each part consists of a 6-character word followed by a space, then followed by an operator.  Since the opertors are at least 3-characters long, that means a string of n characters will have (at most) n/10 parts.  There may be other text in attr_a (in your example, there was a ',') that will be ignored.
The first sub-query below, cntr, generates the numbers 1, 2, 3, ... up to the greatest possible numbr of parts in any attr_a.
The second sub-query, got_part, extracts each part from attr_a.
The main query parses each part into the columns you want.WITH cntr     AS
     SELECT     LEVEL     AS n
     FROM     (
               SELECT MAX (LENGTH (attr_a))
                    / 10     AS max_parts
               FROM     a
     CONNECT BY     LEVEL     <= max_parts
,     got_part     AS
     SELECT     REGEXP_SUBSTR ( a.attr_a
               , '[A-Z][0-9]{5} +(AND|\(\+\)|\(-\))'
               , 1
               , c.n
               )          AS part
     FROM     a
     JOIN     cntr     c ON c.n <= LENGTH (a.attr_a) / 10
SELECT     REGEXP_SUBSTR (part, '[A-Z][0-9]{5}')     AS column_1
,     REGEXP_SUBSTR (part, '[0-9]')          AS column_2
,     REGEXP_SUBSTR (part, '[^ ]+$')     AS column_3
FROM     got_part
WHERE     part     IS NOT NULL

Similar Messages

  • 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 inherit attribute values in object tables?

    I am trying to implement object inheritance with oracle 10g express. What i have done so far is created some types and subtypes. And some tables based on those types and sub types. So far i have understood that the subtypes inherit the attributes and methods from its super types.
    But is there a way to inherit the attribute values from the object table of the super type to the object table of the sub type?
    For example: The object O1 , explicitly labeled with (sIPO1 , wIPO1) , also inherits the intended purpose (sIPT 1 wIPT 1) from T1 . Similarly, the object O3 inherits the intended purposes from T3 , O1 and T1 . Note, however, that O2 , which is not labeled, inherits the intended purpose from T2 , but not from O1 nor T1 , as the intended purposes are not inherited through the reference-of relation.
    _a visual of the above description [http://picasaweb.google.com/lh/photo/1YBAQbCMQMBmd8oyw9SyNw?feat=directlink]_
    How can the types and objects be labeled as mentioned above? And how can these labels be made inheritable by the subtypes and objects based on those subtypes?
    Possible Solution*
    Only way which i could think of is using relational tables, like this: type_label(type_name, label1, label2) and a similar table table_label(table_name, label1, label2) for labeling the object tables. Then refer to these labels through some java programming. Will this be a right approach. I doubt that this will defeat the very intentions of the object database. And i hope there is a straight solution in Object Relational methods instead of java programming.
    nested tables and vararrays... will using them help solving the above problem some how?

    From those examples i can see that although the nested tables will have the super type attributes and values with them, if i have to change those attribute values the values in the whole table gets changed.
    is it possible to change the super type attribute values which is corresponding to the nested table values alone and not disturb the over all table?

  • How to get attribute value from an object inside an object in Xpress

    Does anyone know how to get an attribute value from an object in Xpress in a workflow? I have an object structured as follows:
    <ResourceInfo accountId='mj628' tempId='3483372b787ce7dd:-5d99a0c5:130cb238483:-3600'>
    <ObjectRef type='Resource' name='Google Apps'/>
    </ResourceInfo>
    I need if possible to get the name='Google Apps', which is inside the ObjectRef, so I guess its an attribute value of an object inside an object.

    If the ResourceInfo object is accessible in a variable, i.e. named "myResInfo", you just have to check the Java API and call the relevant method:
    <invoke name='getResourceName'>
      <ref>myResInfo</ref>
    </invoke>

  • How to get attribute values from one view to another

    HI all,
    Thx in Advance..
    I have 2 view like v1,v2.In v1 i used one attribute values from "get single attribute" method.And i need the same values in v2 screen.For this i did in v1 outbound plugs , i mentioned the parameter name . How can i get the same values in  v2.

    Hi chandru ,
    you said you declare the parameters in the Outbound Plug of V1.  now go to view V2 inbound plug Tab and creat one inbound plug
    double click on the plug name .it will navigate you to the event handeler method . Now add the outbound parameter variables in the
    parameters
    For example : V1firing the navigation plug
    a type string " defined in parameter
      wd_this->fire_out_to_view2_plg(
        a =      'ABCD'                           " string
    you can retrive the value freely in v2 inbound event handeler
    a type string " defined in parameter
    *   set single attribute
        lo_el_context->set_attribute(
          name =  `TEXT`
          value =  a )." here you will get the 'ABCD'.
    regards
    Chinnaiya P
    Edited by: chinnaiya pandiyan on Jun 23, 2010 7:12 PM

  • How to get attribute value of a node

    Hi experts
    I have a mapped node in my view context from component controller context. This node consists of 2 value attributes inside
    Example:
    NODE1             -
    > Cardinality 1..1, seleciton 1..1
       -- x_date         -
    > type DATS
       -- x_years        -
    > dec3
    How do I get the attribute value attr1 and attr2 ??
    Here is my code in my view method
      DATA: lr_node_info TYPE REF TO if_wd_context_node_info,
            l_date       TYPE dats,
            l_xyears     TYPE i.
      lr_node_info = wd_context->get_node_info( ).
      lr_node_info = lr_node_info->get_child_node('NODE1').
       l_date       = lr_node_info->get_attribute( name = 'X_DATE' ).
       l_xyears     = lr_node_info->get_attribute( name = 'X_YEARS' ).
    It does not seems to work since it says < the result type of the function method can not be converted into the result type L_DATE>
    I try to understand why but not sucessful, please help and thank you for your kindness

    Hi Dean,
    Regading uour problem of reading the attributes value of the context node, you have to  use the code wizard. that ia avaliable on the top toolbar when you are inside the View Method
    There is option to read context  select that radio button option and then thru F4 help
    if you can select the node then Code is automatically generated with variable declaration.!!
    Like this :
      DATA lo_nd_node1 TYPE REF TO if_wd_context_node.
        DATA lo_el_node1 TYPE REF TO if_wd_context_element.
        DATA ls_node1 TYPE wd_this->element_node1.
        DATA lv_x_date LIKE ls_node1-x_date.
        DATA lv_x_year LIKE ls_node1-x_year.   
      navigate from <CONTEXT> to <NODE1> via lead selection
        lo_nd_node1 = wd_context->get_child_node( name = wd_this->wdctx_node1 ).
      get element via lead selection
        lo_el_node1 = lo_nd_node1->get_element(  ).
      get all declared attributes
        lo_el_node1->get_static_attributes(
          IMPORTING
            static_attributes = ls_node1 ).
        lv_x_date = ls_node1-x_date.
        lv_x_date = ls_noe1-x_year.
    if you can select the attribute then Code is automatically generated with variable declaration.!!
    DATA lo_nd_node1 TYPE REF TO if_wd_context_node.
      DATA lo_el_node1 TYPE REF TO if_wd_context_element.
      DATA ls_node1 TYPE wd_this->element_node1.
      DATA lv_x_date LIKE ls_node1-x_date.
    navigate from <CONTEXT> to <NODE1> via lead selection
      lo_nd_node1 = wd_context->get_child_node( name = wd_this->wdctx_node1 ).
    get element via lead selection
      lo_el_node1 = lo_nd_node1->get_element(  ).
    get single attribute
      lo_el_node1->get_attribute(
        EXPORTING
          name =  `X_DATE`
        IMPORTING
          value = lv_x_date ).
    Hopes this will helps you.
    Regard
    Manoj Kumar

  • How to pass attribute values through variables in JSP  Custom TagLib

    Hi,
    Can anybody help me how to pass values through varuables in the jsp custom tag.
    i am using JSP custom tag. I am unable to pass attribute values through variables.
    <invitation:invdetails invid="<%=invid%>"/> The value is passing as <%=invid%> ,not value of the invid.
    But i am getting throuh the fllowing
    <invitation:invdetails invid='1' />
    Please anybody suggest me how to pass value by using the variable.

    Hi,
    It sounds like you need to set the <rtexprvalue> tag to true in the TLD for your tag. If you do this the tag will read in the value you are trying to pass to it.
    dapanther...

  • How to assign attribute values to a range of BPs ????

    Hi All,
         While assigning attribute values to business partners we can specify at the most one business partner at a time.
    My requirement is to assign attribute values to a range of business partners at a time.
    Is there any customization setting where I can do this OR
    do I write a report for this ?
    Regards,
    Ashish

    Hi Ravi,
          Thanks for replying !!!!
    But, CRMD_MKT_TOOLS doesnt seem to solve my problem.
    I have a range of BPs (e.g 8000101 to 8000199).
    And I have a list of attribute sets with values as follows:-
    Attribute Set            Values
    Age group                1 - 10, 11 - 20, ....
    Reading habits          Business, sports, news.....
    Profession                Doctor , Engineer .......
    and so on..
    Now in transaction CRMD_PROF_BP, I can choose a single BP (e.g. 8000101) and assign it an attribute set(e.g. Profession) and value (Doctor).
    But, my requirement is to specify an entire range of BPs(8000101 to 8000150) and assign attribute set and values to that entire range.
    Now how do I achieve this ???????
    (target groups would be created only after attributes have been assigned)
    Regards,
    Ashish

  • How to pack attribute values in a soap request?

    Hello,
    We are trying to make an external webservice call through GWWS.
    The (soap) request contains an element which looks like:
    +<Request Version="1.0" RequestID="11111111" TypeOfRequest="type1" Echo="false">+
    +<Info>+
    +<Account xmlns="http://something.com/Domain1/">ABCD1234</Account>+
    +</Info>+
    +</Request>+
    We had created this soap request based on the WSDL provided to us by the webservice host.
    We used a tool (like soapui) to generate the the above request.
    To be able to make a service call to this webserive, we used the wsdlcvt to generate the fml32 field headers as:
    wsdlcvt -i <provided wsdl> -o <baseoutput name>
    However we could not find a way to pack in the the information related to the attributes.
    In vain, we tried to use the option [-m] with wsdlcvt.
    Since there are no field headers generated by the wsdlcvt for the attributes, we do not know how do we put values of "Version", "RequestID", "TypeofRequest", "Echo" attributes of the "Request" element in the webservice request.
    Are we missing something here?
    How can we populate/put information in the attributes of an element in a request?
    Thank you.
    Sincere Regards,
    Mrugendra

    Hello Xu,
    We have a simple test wsdl as follows
    +<?xml version="1.0" encoding="UTF-8"?>+
    +<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://new.webservice.namespace" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://new.webservice.namespace">+
    +<wsdl:types>+
    +<xsd:schema targetNamespace="http://new.webservice.namespace" xmlns="http://new.webservice.namespace" elementFormDefault="unqualified" attributeFormDefault="unqualified">+
    +<xsd:complexType name="Service_Type">+
    +<xsd:sequence>+
    +<xsd:element name="DateTime" type="xs:dateTime" nillable="true">+
    +</xsd:element>+
    +<xsd:element name="UUID" type="xs:string" nillable="true">+
    +</xsd:element>+
    +<xsd:element name="Status" nillable="true" minOccurs="0" maxOccurs="unbounded">+
    +<xsd:complexType>+
    +<xs:sequence>+
    +<xs:element name="StatusDesc" type="xs:string">+
    +</xs:element>+
    +</xs:sequence>+
    +<xsd:attribute name="StatusTyp" type="xs:string" use="required">+
    +</xsd:attribute>+
    +</xsd:complexType>+
    +</xsd:element>+
    +</xsd:sequence>+
    +<xsd:attribute name="Version" type="xs:string" use="required">+
    +</xsd:attribute>+
    +<xsd:attribute name="Name" type="xs:string" use="required">+
    +</xsd:attribute>+
    +</xsd:complexType>+
    +</xsd:schema>+
    +</wsdl:types>+
    +<wsdl:message name="GetServiceReq">+
    +<wsdl:part name="ServiceReq" type="tns:Service_Type"/>+
    +</wsdl:message>+
    +<wsdl:message name="GetServiceRes">+
    +<wsdl:part name="ServiceRes" type="tns:Service_Type"/>+
    +</wsdl:message>+
    +<wsdl:portType name="ServicePortType">+
    +<wsdl:operation name="getService">+
    +<wsdl:input message="tns:GetServiceReq"/>+
    +<wsdl:output message="tns:GetServiceRes"/>+
    +</wsdl:operation>+
    +</wsdl:portType>+
    +<wsdl:binding name="ServiceBinding" type="tns:ServicePortType">+
    +<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>+
    +<wsdl:operation name="getService">+
    +<soap:operation soapAction="getService"/>+
    +<wsdl:input>+
    +<soap:body use="literal"/>+
    +</wsdl:input>+
    +<wsdl:output>+
    +<soap:body use="literal"/>+
    +</wsdl:output>+
    +</wsdl:operation>+
    +</wsdl:binding>+
    +<wsdl:service name="Service">+
    +<wsdl:port name="getService" binding="tns:ServiceBinding">+
    +<soap:address location="No Target Adress"/>+
    +</wsdl:port>+
    +</wsdl:service>+
    +</wsdl:definitions>+
    When we create a soap request (Using soapiu) from the above wsdl we get:
    +<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">+
    +<soapenv:Header/>+
    +<soapenv:Body>+
    +<ServiceReq Version="?" Name="?">+
    +<DateTime>?</DateTime>+
    +<UUID>?</UUID>+
    +<!--Zero or more repetitions:-->+
    +<Status StatusTyp="?">+
    +<StatusDesc>?</StatusDesc>+
    +</Status>+
    +</ServiceReq>+
    +</soapenv:Body>+
    +</soapenv:Envelope>+
    As you can see that ServiceReq has attributes Version and Name
    However, wsdlcvt (with -m) creates the following fml32 headers
    DateTime        1       string  -       fullname=DateTime, schema=xs:dateTime
    ServiceReq      2       fml32   -       fullname=ServiceReq, schema=tns:Service_Type
    ServiceRes      3       fml32   -       fullname=ServiceRes, schema=tns:Service_Type
    Status  4       fml32   -       fullname=Status, schema=tns:Status
    StatusDesc      5       mbstring        -       fullname=StatusDesc, schema=xs:string
    UUID    6       mbstring        -       fullname=UUID, schema=xs:string
    The points that we did not understand:
    1. You mentioned: "SALT will map the *whole* request to FLD_MBSTRING
    It is not so in this case.
    Did we miss something?
    2. Going by your suggestion in your last reply how do we create the FML32 buffer (specifically for the "ServiceReq" element, with attributes) for the sample we have?
    Thank you.
    Sincere Regards,
    Mrugendra

  • Regular Expression - replaceAll() - how to replace words?

    Hiya,
    I have this regex to replace all instances of myWord:
    String oldWord = "oldWord";
    String newWord = "newWord";
    String sentence = "some sentence that contains " + oldWord;
    String newSentence = replaceWordsInSentence(sentence, oldWord, newWord);
    private String replaceWordsInSentence(String sentence, String oldWord, String newWord) {
        return sentence.replaceAll("\b" + oldWord + "\b", newWord);
    }...it works in most instances, but when oldWord is at the end of the sentence it is not replaced. Presumably the problem is that "/b" is not a sufficient word boundary. Can someone help me out with the correct regular expression code?
    Thanks,
    James

    Mel, you did appear to misunderstand as you thought points 2 and 3 were alternatives, but you now recognise that they are additional "shoulds".
    Of course, I applied the extra backslash as soon as Joachim advised. Maybe you don't agree with my rationale, but I prefer the complete solution that will work in all instances... so was simply waiting for him to post a code example that included the latter 2 points as (although I understood the point of them perfectly) I was not sure how to implement them.
    Have come up with the following, expanded, method...
        private String replaceWordsInSentence(String sentence, String oldWord, String newWord) {
            return sentence.replaceAll("\\b" + Pattern.quote(oldWord) + "\\b", Matcher.quoteReplacement(newWord));
        }...works fine with the tests I have run. Joachim, can you confirm this is correct.

  • How to search attribute values

    How to find the attribute values ("0_0_0_1" ) in the following xml example.
    Example:
    var xml:XML=
    <root>
    <country id="0">
    <states id="0_0">
    <city id="0_0_0">
    <village id="0_0_0_0"></village>
    <village id="0_0_0_1"></village>
    <village id="0_0_0_2"></village>
    </city>
    </states>
    <states id="0_1">
    </states>
    </country>
    <country id="1"></country>
    </root>

    Do you mean like a depth first search?
    package
              import flash.display.Sprite;
              public class XmlAttributes extends Sprite
                        protected var xml:XML = <root>
                                                                                              <country id="0">
                                                                                                        <states id="0_0">
                                                                                                                  <city id="0_0_0">
                                                                                                                            <village id="0_0_0_0"></village>
                                                                                                                            <village id="0_0_0_1"></village>
                                                                                                                            <village id="0_0_0_2"></village>
                                                                                                                  </city>
                                                                                                        </states>
                                                                                                        <states id="0_1">
                                                                                                        </states>
                                                                                              </country>
                                                                                              <country id="1"></country>
                                                                                    </root>;
                        public function XmlAttributes()
                                  super();
                                  var result:XML = depthFirstSearch(xml);
                                  trace(result.localName());
                        public function depthFirstSearch(node:XML):XML
                                  for each (var child:XML in node.children())
                                            if (("@id" in child) && (child.@id == "0_0_0_1"))
                                                      return child;
                                            else
                                                      var result:XML = depthFirstSearch(child);
                                                      if(result)
                                                                return result;
                                  return null;
    The XML tags in the code example above are being stripped - not sure why they cannot be encoded / escaped.  It is the XML from your example.

  • How to retrieve attribute value from my JSP?

    My servlet needs to redirect to a JSP. Before that, I set an attribute value.
    getServletContext().setAttribute("filename",templateFile);
    RequestDispatcher rd = getServletContext().getRequest...
    rd.forward(request, response);
    In my JSP, this is how I want to retrieve it:
    <%
    String filename = (String)request.getAttribute("filename");
    if (filename != null)
    %>
    <%= filename %>
    <%
    else
    %>
    it is null
    <%
    %>
    But the value is always null? Do I need any tag or declaration on the top of my JSP?

    Can i set attribute for list and get that list using request.getAttribute() in jsp?
    ex.
    in action
    List plist;
    plist = ...
    request.setAttribute("plist", plist);
    to get this value in jsp
    <%
    List plist = (List)request.getAttribute("plist");
    %>
    is this code is allowed?

  • Mapping Issue: How to split the value  of Lineitem

    Hi  All,
    I have issue in Mapping .XML-> BAPI Scenario
    1 line item  has the  one 50% Cost Centre , another 50% Cost centre data
    2 line item has only      100% WBS elemnt
    WBS elemnt mapping :
    If A |EQUALS (Text) | WBS_ELEMNT   |If without else|  B(WBS value)  |REmoveContexs| SplitByValue|   WBS_ELEMNT(BAPI field)
    But this supress second line item : WBS_ELEMNT data and uploads into1.Item .Hence PO is not getting created in SAP.
    Could you please giv me a logic to actaually split the value into 2 seperate so that respective data of each line item  are split properly .
    Thank you ,
    Vara

    Hi I think you need an udf for this:
    int total = Integer.parseInt(value[0]);
    result.addValue(Integer.toString(a/2));
    result.addValue(Integer.toString(a/2));
    and after it you can add a splitbyvalue

  • How to extract attribute value from an XML

    I have column where all my diffrent structures of XML's are getting stored. I want extract a patticular attribute value from all the XML’s. Can any one help me with this?
    Thanks,
    swagath

    Kindly refer to the EXTRACTVALUE function in your online documentation and refrain from further doc questions.
    Sybrand Bakker
    Senior Oracle DBA

  • Hi Friends, i have to validate the min.length attribute using Regular expression, The min.length accepts single value digit only which accepts =5 & min.length accepts =9 please guide me as soon as possible

    dfdsfds

    User,  we need to know your jdev version!
    It would be helpful if your question would not only the header of the post.
    Can you please rephrase your question? Somehow i don't understand xour question.
    Timo

Maybe you are looking for

  • Calling Web Service created in XI 3.0 from Web Dynpro

    i hv created a webservice in XI 3.0. Here im accessing a RFC through XI 3.0. Now, using java proxy generation facility of XI 3.0 i hv generated the code for tht web service. Then in web dynpro i developed a j2ee application using the generated code.

  • Ocrfile is not being written to.  open file issues.  Help please.

    I've been troubleshooting an open file issue on our Test environment for quite a while now. Oracle has had me update to latest CRS bundle for 10.2.0.3, then upgrade to 10.2.0.4, then two more patches via OPatch to bring 10.2.0.4 RAC to it's most rece

  • [Solved] Removing "Recently Used" and "Search" Entries from Open/Save

    Each time I save or open a document, the dialog box defaults to "Recently Used". What I'm wanting to find out is how to get rid of the entry from the "Places" bar altogether. I understand that the entry was put there with good intentions, but it seem

  • Time Machine encryption issue on IMAC w/ external disk

    When I try to encrypt backup to my external My Passport disk I get this error message "There was an error preparing the Time Machine backup disk "Passport MAC". A recovery system for the targeted disk is required."  What do I need to do?  Does this m

  • Audio Headphone Jack Problem

    I'm in college so  in my dorm room I always use headphones on my macbook pro. Lately I have been cycling through headphones every 4 or so weeks. I have a macbook pro 10.7.3 and I use skullcandy headphones. When I first use them the sound quality is g