AnsweredAssumed Answered

XOG in GEL inserting wrong value

Question asked by emre.emirlioglu on Jan 29, 2016
Latest reply on Feb 1, 2016 by Dave_3.0

Hi,

 

Having issues with trying to write to custom object instance.

 

The query, and xog is listed further down.

 

I have a log in the core:foreEach to get an output and below is what the output is showing me (the values are as expected).

 

The ineresting part are the values for z_produkt, which is different for every value, as expected. When viewing the instance on the application and in the DB, the value for z_produkt is only 5020002 but all other attribute are xogged in correctly.

 

What i'm i doing wrong?

 

 

 

 

VALUES FROM FIRST QUERY ROW

Object instance:           5008031

Rownum:                      1

id:                                 5008031

xog_code_name:          00000095

proj_id:                         5021001

parent_proj_id:             5020001

parent_proj_code:        00000030

parent_object_code:     project

z_produkt:                    5020002

z_prod_layout:             Produkt A

z_antal:                        3065

 

VALUES FROM SECOND QUERY ROW

Object instance:           5008031

Rownum:                      2

id:                                 5008031

xog_code_name:          00000096

proj_id:                         5021001

parent_proj_id:             5020001

parent_proj_code:        00000030

parent_object_code:     project

z_produkt:                    5020003

z_prod_layout:             Produkt b

z_antal:                        2400

 

VALUES FROM THIRD QUERY ROW

Object instance:           5008031

Rownum:                      3

id:                                 5008031

xog_code_name:          00000097

proj_id:                         5021001

parent_proj_id:             5020001

parent_proj_code:        00000030

parent_object_code:     project

z_produkt:                    5025001

z_prod_layout:             Produkt d

z_antal:                        3065

 

 

 

Print screen from the instances in CA PPM

 

 

 

Print screen from SQL Server manager

 

 

The interesting part of the GEL

 

<!--=================== query to get investment, product, and amount ===================-->

        select ROW_NUMBER() OVER (ORDER BY oczsp.id) Rownum

        ,oczsp.id

        ,RIGHT('000000'+ CONVERT(NVARCHAR,(oczsp.code  + (ROW_NUMBER() OVER (ORDER BY oczsp.id))) -1 ),8) xog_code_name

        ,inv.id proj_id

        ,parent_inv.id parent_proj_id

        ,parent_inv.code parent_proj_code

        ,parent_inv.odf_object_code parent_object_code

        ,oczkp.z_produkt

        ,oczkp.z_prod_layout

        ,oczkp.z_antal

        from odf_ca_z_salj_prod oczsp

        join odf_multi_valued_lookups omvl on omvl.pk_id = oczsp.id

        join inv_investments inv on inv.id = omvl.value and omvl.ATTRIBUTE = 'z_cc_projekt'

        join inv_investments parent_inv on parent_inv.id = oczsp.odf_parent_id

        join ODF_CA_Z_KOPPLAD_PRODUKT oczkp on oczkp.odf_parent_id = oczsp.odf_parent_id

 

        --where oczsp.id = '5005001'

        where oczsp.id = ${gel_objectInstanceId}

        and CONCAT(inv.id,oczkp.z_produkt) not in (select CONCAT(omvl.value, oczsp.z_prod_artikel)

                                                    from odf_ca_z_salj_prod oczsp

                                                    join odf_multi_valued_lookups omvl on omvl.pk_id = oczsp.id

                                                    and omvl.ATTRIBUTE = 'z_cc_projekt'

                                                    )

 

    </sql:query>

   

<!--=================== Store attributes ===================-->

 

    <core:forEach trim="true" items="${v_qryresult.rows}" var="row">

        <core:set var="Rownum" value="${row.Rownum}"/>

        <core:set var="id" value="${row.id}"/>

        <core:set var="xog_code_name" value="${row.xog_code_name}"/>

        <core:set var="proj_id" value="${row.proj_id}"/>

        <core:set var="parent_proj_id" value="${row.parent_proj_id}"/>

        <core:set var="parent_proj_code" value="${row.parent_proj_code}"/>

        <core:set var="parent_object_code" value="${row.parent_object_code}"/>

        <core:set var="z_produkt" value="${row.z_produkt}"/>

        <core:set var="z_prod_layout" value="${row.z_prod_layout}"/>

        <core:set var="z_antal" value="${row.z_antal}"/>

       

        <gel:log>

            Object instance:        ${gel_objectInstanceId}

            Rownum:                    ${row.Rownum}

            id:                        ${row.id}

            xog_code_name:            ${row.xog_code_name}

            proj_id:                ${row.proj_id}

            parent_proj_id:            ${row.parent_proj_id}

            parent_proj_code:        ${row.parent_proj_code}

            parent_object_code:        ${row.parent_object_code}

            z_produkt:                ${row.z_produkt}

            z_prod_layout:            ${row.z_prod_layout}

            z_antal:                 ${row.z_antal}

        </gel:log>

 

       

<!--=================== Parse XOG read to set cc/projekt name ===================-->       

       

        <gel:parse var="update_product">

            <NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_customObjectInstance.xsd">

                  <Header action="write" externalSource="NIKU" objectType="customObjectInstance" version="14.3.0.298"/>

                  <customObjectInstances objectCode="z_salj_prod">

                    <instance instanceCode="${row.xog_code_name}" objectCode="z_salj_prod" parentInstanceCode="${row.parent_proj_code}" parentObjectCode="${row.parent_object_code}">

                      <CustomInformation>

                        <ColumnValue name="code">${row.xog_code_name}</ColumnValue>

                        <ColumnValue name="name">${row.xog_code_name}</ColumnValue>

                        <ColumnValue name="odf_cncrt_parent_id">${row.parent_proj_id}</ColumnValue>

                        <ColumnValue name="odf_parent_id">${row.parent_proj_id}</ColumnValue>

                        <ColumnValue name="z_cc_projekt_layout">${row.proj_id}</ColumnValue>

                        <ColumnValue name="z_kvar_att_dela">${row.z_antal}</ColumnValue>

                        <ColumnValue name="z_prod_artikel">${row.z_produkt}</ColumnValue>

                        <ColumnValue name="z_tot_fran_prod">${row.z_antal}</ColumnValue>

                      </CustomInformation>

                    </instance>

                  </customObjectInstances>

                </NikuDataBus>

        </gel:parse>

Outcomes