Cannot assign value to a Variable of Complex Type beyond index 1

Hello:
I have a variable defined as a complex type as followed. I tried to assign a value to each of the two elements but it only allows me to assign to the 'element#1.
This statement that tries to assign a value into element#2 will not work, if I assign with '[1]' for the first element it will work:
<copy> <---- THIS WORKS
<from expression="'John'"/>
<to variable="My_Variable"
part="My_Collection"
query="/ns9:My_Collection/ns9:Collection/ns9:Collection_Item[1]/ns9:pname"/>
</copy>
<copy> <---- THIS DOES NOT WORK
<from expression="'John'"/>
<to variable="My_Variable"
part="My_Collection"
query="/ns9:My_Collection/ns9:Collection/ns9:Collection_Item[2]/ns9:pname"/>
</copy>
Is there something wrong with my definition below that allows only element#1 to be refererenced but not element#2???? Am I missing some kind of initialization that is needed to initialize both elements????
Here are my message and Complex Type definitions:
<variable name="My_Variable" messageType="ns8:args_out_msg"/>
<message name="args_out_msg">
<part name="My_Collection" element="db:My_Collection"/>
</message>
<element name="My_Collection">
<complexType>
<sequence>
<element name="Collection" type="db:Collection_Type" db:index="2" db:type="Array" minOccurs="0" nillable="true"/>
<element name="Ret" type="string" db:index="3" db:type="VARCHAR2" minOccurs="0" nillable="true"/>
</sequence>
</complexType>
</element>
<complexType name="Collection_Type">
<sequence>
<element name="Collection_Item" type="db:Collection_Type_Struct" db:type="Struct" minOccurs="0" maxOccurs="unbounded" nillable="true"/>
</sequence>
</complexType>
<complexType name="Collection_Type_Struct">
<sequence>
<element name="pname" db:type="VARCHAR2" minOccurs="0" nillable="true">
<simpleType>
<restriction base="string">
<maxLength value="25"/>
</restriction>
</simpleType>
</element>
</sequence>
</complexType>
The error msg it gives me is as followed:
[2010/09/04 00:47:59] Error in <assign> expression: <to> value is empty at line "254". The XPath expression : "" returns zero node, when applied to document shown below:less
oracle.xml.parser.v2.XMLElement@1fa7874
[2010/09/04 00:47:59] "{http://schemas.xmlsoap.org/ws/2003/03/business-process/}selectionFailure" has been thrown.less
-<selectionFailure xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/">
-<part name="summary">
<summary>
XPath query string returns zero node.
According to BPEL4WS spec 1.1 section 14.3, The assign activity &lt;to&gt; part query should not return zero node.
Please check the BPEL source at line number "254" and verify the &lt;to&gt; part xpath query.
</summary>
</part>
</selectionFailure>
Thanks
Newbie

Hello:
Base on the suggestion to use 'append' instead of 'copy', I tried to define a 'singleNode' which is of type 'Collection_Type_Struct' so I can append this individual 'struct' into my array (i.e. as the 2nd. element of my array "/ns9:My_Collection/ns9:Collection/ns9:Collection_Item"), but I am getting an error in defining this variable as:
<variable name="singleNode" element="Collection_Type_Struct"/> <--- error
Can someone tell me how should I define "singleNode" so I can put a value in it and then append this 'singleNode' into the array:
<variable name="singleNode" element=" how to define this????"/>
<assign>
<copy>
<frem expression="'Element2Value'"/>
<to variable="singleNode"
part="My_Collection"
query="/ns9:My_Collection/ns9:Collection/ns9:Collection_Item/ns9:pname"/>
</copy>
</assign>
<bpelx:assign>
<bpelx:append>
<from variable="singleNode" query="/ns9:My_Collection/ns9:Collection/ns9:Collection_Item"/>
<to variable="My_Variable"
"part="My_Collection"
query="/ns9:My_Collection/ns9:Collection"/>
</bpelx:append>
</bpelx:assign>
Again here is my definition in my .xsd file:
<element name="My_Collection">
<complexType>
<sequence>
<element name="Collection" type="db:Collection_Type" db:index="2" db:type="Array" minOccurs="0" nillable="true"/>
<element name="Ret" type="string" db:index="3" db:type="VARCHAR2" minOccurs="0" nillable="true"/>
</sequence>
</complexType>
</element>
<complexType name="Collection_Type">
<sequence>
<element name="Collection_Item" type="db:Collection_Type_Struct" db:type="Struct" minOccurs="0" maxOccurs="unbounded" nillable="true"/>
</sequence>
</complexType>
<complexType name="Collection_Type_Struct">
<sequence>
<element name="pname" db:type="VARCHAR2" minOccurs="0" nillable="true">
<simpleType>
<restriction base="string">
<maxLength value="25"/>
</restriction>
</simpleType>
</element>
</sequence>
</complexType>
Thanks for any help!!!!

Similar Messages

  • Execute SQL Task: Cannot assign value to the variable

    DECLARE
    @PartitionDate varchar(8),
    @Date int
    SELECT
    @PartitionDate = MAX(PartitionDate)
    FROM PartitionLog (NOLOCK)
    SELECT
    @Date = MIN(DateKey)
    FROM DimDate WHERE CAST(DateKey as varchar(8)) > @PartitionDate
    IF NOT CONVERT(varchar(8),GETDATE(),112) = @PartitionDate
    SELECT @PartitionDate = CAST(DateKey as varchar(8))
    FROM DimDate (NOLOCK)
    WHERE DateKey = @Date
    SELECT @PartitionDate AS PartitionDate ,
    'IISDW_' + @PartitionDate AS PartitionName
    GO
    I have the above SQL stmt in the excute SQL task and declared 2 variable "PartitionDate" and "PartitionName" in the Package, the RESULT SET I hav given as "Single Row" and when I run the ETL I get the error as 
    [Execute SQL Task] Error: An error occurred while assigning a value to variable "PartitionDate": "Exception from HRESULT: 0xC0015005".

    Does your package variable datatype match the datatype of your parameter?
    Is your Package variable assigned to the parameter in the task editor?
    And does the parameter name in the task editor match the parameter names in your stored procedure?

  • Can we assign value to a variable in PL/SQL Loop

    Hi
    Can we assign value to a variable in PL/SQL Loops?
    DECLARE
    V_Num NUMBER;
    BEGIN
    LOOP
    V_Num := 10;
    DBMS_OUTPUT.put_line(V_num);
    V_Num := V_Num - 1;
    EXIT WHEN V_Num = 0;
    END LOOP;
    END;
    In the above program, Can we assign V_num with a value 10????????
    Thanks & Regards,
    Hari Babu
    Edited by: 1004977 on Jun 5, 2013 2:40 AM

    Hi,
    1004977 wrote:
    Hi
    Can we assign value to a variable in PL/SQL Loops?
    DECLARE
    V_Num NUMBER;
    BEGIN
    LOOP
    V_Num := 10;
    DBMS_OUTPUT.put_line(V_num);
    V_Num := V_Num - 1;
    EXIT WHEN V_Num = 0;
    END LOOP;
    END;
    In the above program, Can we assign V_num with a value 10????????Yes; the example you posted does that.
    When the loop starts, the value 10 is assigned to v_num. You should see that value displayed by the put_line statement.
    After that, v_num is set to 10 - 1 = 9.
    Next, the EXIT condition is evaluated. At this point, v_num is 9, not 0, so the loop runs again. V_num is set to 10 again, and the loop continues forever (or, in some versions, until the dbms_output buffer is filled and an error occurs.)

  • Error while executing the Job:Cannot assign NULL to host variable 1

    Hello!
    I have the following issue:
    Error while executing the Job:Cannot assign NULL to host variable 1. setNull() can only be used if the corresponding column is nullable. The statement is "INSERT INTO "VIRSA_... (see log for details)
    Note 1362138 - Rule generation - null pointer exception virsa_cc_rtmap  doesn't me. After uploading files of ZCC_DOWNLOAD_SAPOBJ and ZCC_DOWNLOAD_DESC I got the same problem during job running...
    How can I find out where is the problem?

    Hi
    That looks like your fields are disabled but they could still be causing the problem edited ( nah - talking rubbish as you've put dummy " " in there) edited - the 'null' error caused many background jobs to fail but, once we had the evidence to show the space (somebody had pressed enter instead of delete/backspace to clear the entry) it stopped the problem - just a bit of learning on the job which we all go through for the GRC chaps in KL.
    A " " would be valid but a    (I know you can't see it but it's there wouldn't be      )
    edited.When you did an edit/replace did it say it had replaced anything please?edited
    The word doc option does sound good!
    Cheers
    David
    Edited by: David Berry on Nov 4, 2010 7:33 PM

  • Assigning value to a variable.

    i have one doubt.
    we can assign value to a variable either in declaration section or in exectuion section.
    so please explain when and wherer should we assign value to a variable.
    thank you very much.

    I think the best way to look at it is...
    If you don't want your variable(s) to have default values that are NULL, assign a value in the declaration section, otherwise assign it where you feel like.
    If you take an example of:
    declare
      v_sum number := 0; -- default variable to 0
      cursor cur_test is
    begin
      for i in cur_test
      loop
        v_sum := 0; -- set variable to 0 before the loop
        loop
          exit when .. some condition ..
          v_sum := v_sum + ..
        end loop;
      end loop;
    end;
    /.. we have a need to set the variable v_sum to 0 before each iteration of the internal loop, so there's little point in having it defaulted to 0 in the declaration section, hence I wouldn't typically default it there and would typically have the code as..
    declare
      v_sum number; -- no point in defaulting it
      cursor cur_test is
    begin
      for i in cur_test
      loop
        v_sum := 0; -- set variable to 0 before the loop
        loop
          exit when .. some condition ..
          v_sum := v_sum + ..
        end loop;
      end loop;
    end;
    /It all depends on what you're doing and what seems the most logical or preferred option.
    Defaulting values in the declaration section can let you see clearly what the starting values are for things, but only if you really need to do it.

  • Assign value to ODI variable from Jython

    Hello Experts,
    I have a procedure where I'm using Jython code. I want to assign a value to an ODI project variable from a Jython function:
    Example:
    #COUNTER = len(v_jythonList) ---> being #COUNTER the ODI project variable and len() the jython function
    Now, i noticed that using ODI variables adds # sign which is use for comments in Jython code. Is there a way to assign values to ODI variables from Jython script?
    Please help!.
    Thanks.
    Pablo.

    Hi,
    Does this post help you :- How to assign value for a ODI variable from Jython Script
    Doc id 424579.1 on metalink should help.
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Dynamically assign value to bind variable in a view object before pageload

    I found that it is extreamely hard to find an example to assign the bind variable in View object at runtime using a data attribute defined in Human task activity. Most of the available samples use a Literal value to do the assignment. In my case, I want to dynamically display the content by assigning the data attribute in Human task to the bind variable in view object before a pageload.
    I do not want to bind the view object to some command component to click a button or link in order to make it work (Unnecessary components in my page).
    The issue is how to access the data attribute in Human task in the java code of client interface in AppModule? or is there a way that I can access the data attribute in Groovy script expression of the bind variable? or if I can access the process data object defined in my BPM process to do the assignment at runtime?
    Really need help on the issue, and I cannot believe that it is so hard to accomplish.
    Thank you very much,

    chk this
    Passing default value to bind variable on page load.
    http://adfcodebits.blogspot.com/2010/03/bit-2-setting-bind-variable-value.html

  • Error in assigning value to local variable

    i am writing a stored procedure in which i have pass parameter if parameter value is zero then i assign a previously declared variable null else that value
    syntax is this
    create or replace
    PROCEDURE usp_Add_Update_Insurance
    p_CityID IN NUMBER DEFAULT NULL
    as
    v_CityID number(10,0);
    begin
    IF p_CityID = 0 THEN
    BEGIN
    v_CityID := NULL;-----giving error in this line
    else
    v_CityID:=p_CityID;
    END;
    END IF;
    end
    begin
    ///some query
    end
    please help someone

    I think there is no added value by putting those Begin/End.
    The simplest solution is just remove them
    Create Or Replace
    Procedure Usp_Add_Update_Insurance (
         P_Cityid In Number Default Null
    ) As
         V_Cityid Number(10,0);
    Begin
         If P_Cityid = 0 Then    
              V_Cityid := Null;
         Else
              V_Cityid:=P_Cityid;
         End If;
         -- do something with V_Cityid    
    End; The only reason for having Begin/End is if you want to catch some exceptions or perform some strange local variable declarations. But it does not seems to be case here.
    MJ

  • Assigning value to a variable in Script Component.

    I'm pretty new to SSIS development and need to figure out a problem with assigning a value to a user defined variable. I created a pretty simple package. It reads a flat file, extracts date from a header record and subsequently uses derived column component
    to reformat data to the desired output format. One of the columns (FileRunDate,
    string, length 8) in the derived component is defined as a string and in the expression I'm assigning it to a variable I set earlier in the script component -
    @[User::vRunTimeDate]. When the process runs, the output file gets generated, however FileRunDate reflects
    originally set varible's value. It seems that the variable assignment in the script task does not work, even though in the debug mode, I do see how the value is being set. The variable has an attribute of ReadWrite. Is it due to the fact that the value is
    being set in the same workflow?
    Any feedback is greatly appriciated.

    Unfortunately I'm unable to add a screenshot of the process, for some reason I get an error message when I try to do that. In a nutshell the entire workflow consist of flat file source component, following by a script component (this is where I read and
    assign the variable) 
        public override void PostExecute()
            IDTSVariables100 vars;
            base.PostExecute();
            // Set run date
            if (strRunDate != null)
                VariableDispenser variableDispenser = (VariableDispenser)this.VariableDispenser;
                variableDispenser.LockForWrite("User::vRunTimeDate");
                variableDispenser.GetVariables(out vars);
                // Set the variable
                vars["User::vRunTimeDate"].Value = strRunDate;
                //Unlock the variable 
                vars.Unlock();
                //Variables.vRunTimeDate = strRunDate;
    then goes conditional split ( filtering out unwanted records), which is connected to a derived column component (this is where one of the columns get assigned a variable's value), one more script component (this where I identify
    specific data element and do a replace command) and finally flat file destination.
    BTW, the article in the provided URL clearly states that variable won't reflect assigned value till the entire workflow has finished. If that's the case, then I think I know my
    answer. Is there is such a thing as putting execution of different steps in a different step, so anything executed subsequently will see that value?

  • Urgent - Assign Value To Bounded Variables

    In My Application Module I Create View With Bound Variables in The Where Condition, I Create Manual JSP To List The Data From The View As Reports Done.
    Pls. Tell Me How & Where I Can Assign Value To The Bounded Values At Run Time
    Regards
    ABG

    If your datasource tag introduces a scripteable vairiable named 'ds' you can use a scriptlet as follows:
    <%
    ds.getRowSet().setWhereClauseParam(int index, Object value);
    %>
    the index is the parameter index, the value is the value of tha parameter. Please look at the BC4J runtime Javadoc for more information.

  • Is an assigned value to an variable in the domain of the data element

    Hi
    how can I check if the value, which I want to assign to an variable is in the domain of the data element of that variable.
    Example:
    I defined a data element myDataElement. The Elementary Type of myDataElement is the Domain myDomain.
    myDomain has the Format: Char with Length 1 and the fixed values 'A' and 'B'.
    The following code works, but IMHO should not:
    DATA testVar TYPE myDomain.
    testVar = 'Foo'.
    The value of testVar is now: 'F' .
    As 'F' is not in the fixed values, this is a behaviour which I don't want. How can I prevent this from not happening (without using a bunch of IFs)?
    In such a case, it were nice if an exception were raised.
    Regards
    Gilles

    Thanks Gungor.
    I tried it with DDUT_DOMVALUES_GET. Works so far. I think I will write some FMs on my own, like this one:
    FUNCTION z_valueisindomain.
    *"*"Local Interface:
    *"  IMPORTING
    *"     REFERENCE(IV_DOMAINNAME) TYPE  DDOBJNAME
    *"     REFERENCE(IV_EVALUATING_VALUE) TYPE  ANY
    *"  EXPORTING
    *"     REFERENCE(EV_DESTINATION) TYPE  ANY
    *"  EXCEPTIONS
    *"      ILLEGAL_INPUT
    *"      NOT_IN_DOMAIN
      DATA domainvalues TYPE TABLE OF dd07v.
      CALL FUNCTION 'DDUT_DOMVALUES_GET'
        EXPORTING
          name          = iv_domainname
        TABLES
          dd07v_tab     = domainvalues
        EXCEPTIONS
          illegal_input = 1
          OTHERS        = 2.
      IF sy-subrc <> 0.
        RAISE illegal_input.
      ENDIF.
      DATA oneline TYPE dd07v.
      LOOP AT domainvalues INTO oneline.
        IF oneline-domvalue_l EQ iv_evaluating_value.
          ev_destination = iv_evaluating_value.
          EXIT.
        ENDIF.
      ENDLOOP.
      IF ev_destination IS INITIAL.
        RAISE not_in_domain.
      ENDIF.
    ENDFUNCTION.
    I'm pretty new to ABAP, so this FM might not be very elegant.
    Regards
    Gilles

  • Mapping descrete values to childs of a complex type array

    Hi all,
    I have the following flat XML file with descrete values as source:
    <MaterialRequest_MT>
      <number><b>number1</b></number>
      <shortdesc><b>shortdesc1</b></shortdesc>
      <projectname><b>projectname1</b></projectname>
    </MaterialRequest_MT>
    My problem is how to map this file to the following destination file where the single values of the source file are values of a child element in a list of complex elements:
    <ns0:query xmlns:ns0="http://QueryService">
            <ns0:attributes>
              <ns0:item>
                <ns0:key>
                  <ns0:system>MP</ns0:system>
                  <ns0:name>PartNumber</ns0:name>
                </ns0:key>
                <ns0:value><b>number1</b></ns0:value>
              </ns0:item>
              <ns0:item>
                <ns0:key>
                  <ns0:system>MP</ns0:system>
                  <ns0:name>Description</ns0:name>
                </ns0:key>
                <ns0:value><b>shortdesc1</b></ns0:value>
              </ns0:item>
              <ns0:item>
                <ns0:key>
                  <ns0:system>MP</ns0:system>
                  <ns0:name>Project</ns0:name>
                </ns0:key>
                <ns0:value><b>projectname1</b></ns0:value>
              </ns0:item>
            </ns0:attributes>
    </ns0:query>
    As you see I don't have a source array over which to iterate. This makes it impossible to me to map the source values to the destination items.
    Any help is very appreciated!
    Thanks!
    Denis

    Hi
    <b>Mapping for item node:</b>
        Create a user defined function with 3 input parameters for number,shortdesc,projectname. In the user defined function check whether each input value exists or not.if the input value exists add the code 'result.addValue("")'.if the 3 input values exist then 3 item nodes will be created.
    <b>Mapping for elements</b>
             Create another user defined function with 3 parameter.take the 3 input values same as the above function. Check whether parameter a value exists in the element and write  <b>result.addValue(a[0]);</b>Do similarly for b and c parameters. After defining this function add standard node function 'splitbyvalue' and assign to the target.
       USedefined function---->splitbyvalue--
    >value.
    I guess this solution is a bit complex.....hope it works
    regards
    Suneel
    Message was edited by: Suneel
    Message was edited by: Suneel

  • Assigning value to Field - Symbol ( which is type of internal table field )

    Hi All,
      I am facing problem to assign the value to a field symbol. My requirement is creating a dynamic internal table and populate values into that internal table, so that i can display the values .
      I am having a structure with fields like status , Plant1 name , Plant2 name.....Plant n .
      So i declared an internal table it_tab with this structure.
      I am having one more table which having number of records for Plant1 ,Plant 2 ,....Plant n based on some condition.
      I need to count the number of records for Plant1 and i need to put in the internal table it_tab.
      For this i created field-symbol .
    Here, t_deployment table will have the plants 1,2,3...and
         t_devobject will have some records for these plants.
    LOOP AT T_DEPLOYMENT. 
    clear w_count.
    LOOP AT T_DEVOBJECT WHERE ZDEPLOYMENT = T_DEPLOYMENT-DOMVALUE_L AND
                              ZADSTATUS = '10'.
    w_count = w_count + 1.
    ENDLOOP.
    concatenate 'it_tab-' t_deployment-domvalue_l into var_bet_name.
    assign var_bet_name to <bet_var_name>.
    now my internal table field i.e. it_tab-plant1 came into <bet_var_name> . But i want to assign a value for it.
    at last what i need is it_tab-plant1 = w_count.
    whaterver the w_count has value that needs to assign to it_tab-plant1. But i don't want to assign directly it it_tab-plant1. I want to assign dynamically. Because tommorrow some more plants added to t_deployments , i don't want to make changes to my program. It should take care....w/o changing the program.
    I tried the following statement.
    (<bet_var_name>) = w_count. But its not working.
    Please let me know how i can get this.
    Thanks in Advance.
    Pavan.

    Hi pavan,
    As ur requirement is creating a dynamic internal table,
    try the following way,
    remember the fieldcat should be of type LVC not SLIS.
    BUILD LT_LVCFIELDCAT in a way that, the value from the internal table becomes the fieldname
    ex:-
    loop at it_models INTO WA_MODELS.
        LS_LVCFIELDCAT-FIELDNAME = WA_models-MODEL.
        LS_LVCFIELDCAT-SELTEXT = WA_models-MODEL.
    append ls_lvcfieldcat to lt_lvcfieldcat.
    endloop.
    DATA: DREF TYPE REF TO DATA,WA_REF TYPE REF TO DATA.
    FIELD-SYMBOLS: <TEMP_TAB> TYPE TABLE, <TEMP_WA> TYPE ANY.
    CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
        EXPORTING
          IT_FIELDCATALOG = LT_LVCFIELDCAT
        IMPORTING
          EP_TABLE        = DREF.
      ASSIGN dref->*  TO <TEMP_TAB>.
    now basing on the fieldcatalog <temp_tab> is build.
    NOW FILL <TEMP_TAB>.
    WHILE FILLING, ASSIGN COMPONENT IDX/NAME.....
    this statement will be very usefull.
    i hope this will be help full.
    pls reward the points if it helps u.
    regards
    Hyma

  • Assigning variable value to another variable

    I want to assign value from one variable with type DATETIME to another variable which has type STRING.
    E.G: I need to convert this variable P_CreatedDate of type DATETIME to STRING variable CreatedDate.
    Can someone help me in C# script. Im using SSIS script task.
    Thanks in advance.
    ZK

    I have a requirement where I need to convert following datetime variable value into the string vaiable format.
    Here is the example: 
    7/23/2014 11:24 PM
    I need above datetime to be converted into following string format
    2014-01-01 03:15:01.470
    yyyyMMdd HHmmssFFF
    Thanks in advance.
    ZK

  • Assigning Value to Variable in Sapscript

    Hi,
    To initialized value of the variable when I tried to assign 0 to variable (like in the following statement) it comes up with error 'Command Expected'.
    &RF140-ZALBT&= '0'.
    Please let me know where and what I am doing wrong in assigning value to a variable?
    Regards,
    Shabbar

    Hi,
    Still its not working. The statement I am writing is
    /: &NET& = &RF140-WRSHB& - &RF140-MSATZ&
    but the system gives error on that.
    NET is the local variable declared with Define statement and both the others are defined in print program.
    Even I tried
    /: &RF140-ZALBT& = &RF140-WRSHB& - &RF140-MSATZ&
    but still the same error.
    Any comments?
    Regards,
    Shabbar

Maybe you are looking for