Clarity

Expand all | Collapse all

XOG and autonumbering Status Reports

Jump to Best Answer
  • 1.  XOG and autonumbering Status Reports

    Posted 12-12-2016 02:55 PM

    Is Satus report a standard or custom object?

    If

    The flag overrideAutoNumbering is an argument that is defined in the XOG header that determines whether the source XOG content overrides autonumbering in the target content. This flag is available for the custom attributes of custom objects.

    and Status Report is autonumbered for code/ID is the argument going to work to get the autonumbered code?

     

    If not is querying the last used and going a few above the the simplest workaround?



  • 2.  Re: XOG and autonumbering Status Reports
    Best Answer

    Posted 12-12-2016 03:59 PM

    - Status Report is Out of the Box (OOTB), which is a subobject from "Project"

    overrideAutoNumbering does not always work. To be honest, I never paid attention when, but for sure it works with my custom objects. I usually do a quick test with Xog. When I cannot use it I use a query to get next ID:

     

    [....]

    <sql:update escapeText="false" var="v_qryresult_0">
    <![CDATA[DECLARE
    P_OBJECT_CODE VARCHAR2(200);
    P_ATTRIBUTE_CODE VARCHAR2(200);
    P_PARTITION_CODE VARCHAR2(200);
    P_TABLE_NAME VARCHAR2(200);
    P_COLUMN_NAME VARCHAR2(200);
    P_PARENT_REFERENCE_ATTR VARCHAR2(200);
    P_PARENT_PK NUMBER;
    P_NEXT_ID VARCHAR2(200);
    BEGIN
    P_OBJECT_CODE := 'costplan';
    P_ATTRIBUTE_CODE := 'code';
    P_PARTITION_CODE := 'NIKU.ROOT';
    P_TABLE_NAME := 'FIN_PLANS';
    P_COLUMN_NAME := 'code';
    P_PARENT_REFERENCE_ATTR := '';
    P_PARENT_PK := 5000000;


    CMN_AUTONUM_GET_NEXT_SP(
    P_OBJECT_CODE => P_OBJECT_CODE,
    P_ATTRIBUTE_CODE => P_ATTRIBUTE_CODE,
    P_PARTITION_CODE => P_PARTITION_CODE,
    P_TABLE_NAME => P_TABLE_NAME,
    P_COLUMN_NAME => P_COLUMN_NAME,
    P_PARENT_REFERENCE_ATTR => P_PARENT_REFERENCE_ATTR,
    P_PARENT_PK => P_PARENT_PK,
    P_NEXT_ID => P_NEXT_ID
    );
    /* Legacy output: */
    DBMS_OUTPUT.PUT_LINE('P_NEXT_ID = ' || P_NEXT_ID);

    -- :P_NEXT_ID := P_NEXT_ID;
    --rollback;
    END;]]>
    </sql:update>

    <sql:query escapeText="False" var="new_autonum_code">
    <![CDATA[
    SELECT next_value next_value_id
    FROM CMN_AUTONUM_SCHEMES
    WHERE 1=1
    AND object_code = 'costplan'
    AND attribute_code = 'code'
    AND partition_code = 'NIKU.ROOT'
    ]]>
    </sql:query>
    <core:forEach items="${new_autonum_code.rowsByIndex}" var="varRow0">
    <core:set value="${varRow0[0]}" var="next_value_id"/>
    <gel:log> next_value_id: ${next_value_id}</gel:log>
    </core:forEach>

     

    [...]

     

     

    this sample is for a "Cost Plan" object. Change object code to your object (ie: Status report)



  • 3.  Re: XOG and autonumbering Status Reports

    Posted 04-13-2017 06:28 AM

    You can use autonumber functionality being given in XOG, and xog will take care of next value to populate however you might need a correct xog to achive this. Please find below sample:

     

    <?xml version="1.0" encoding="UTF-8"?>
    <NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_customObjectInstance.xsd">
    <Header action="write" externalSource="NIKU" objectType="customObjectInstance" version="8.0">
    <args name="overrideAutoNumbering" value="false"/>
    </Header>
    <customObjectInstances objectCode="manufacturer">
    <instance instanceCode="-1" objectCode="manufacturer">
    <CustomInformation>
    <ColumnValue name="code">-1</ColumnValue>
    <ColumnValue name="name">Sony Inc</ColumnValue>
    <ColumnValue name="page_layout">odf.manufacturerFrame</ColumnValue>
    <ColumnValue name="partition_code">ASIA</ColumnValue>
    </CustomInformation>
    </instance>
    </customObjectInstances>
    </NikuDataBus>

     

    If you go through this sample xml you just need to add an arrgument tag inheader section for overrideAutoNumbering and then you need to pass "-1" where you are expecting auto number and clarity will take care while xogging.

     

    Let me know if this helps.

     

    Regards,

    Prashank Singh

    CA PPM Consultant, Pemari Technology



  • 4.  Re: XOG and autonumbering Status Reports

    Posted 12-14-2016 05:28 AM

    Thanks Aurora_Gaimon 

    Querying the next val and using it worked when doing manual XOG.

    Autonumbering for manually created items after that worked OK.

    I assume that should work also when a process creates a new instance.

    Then I can have the query in the script as you had.



  • 5.  Re: XOG and autonumbering Status Reports

    Posted 08-17-2017 09:02 AM

    The CMN_AUTONUM_SCHEMES table contains various entries. For some objects you need to specify another attribute_code to get a valid result. Check the table content to get the right attribute_code.



  • 6.  Re: XOG and autonumbering Status Reports

    Posted 04-13-2017 06:30 AM

    I also tried same and it worked for me also



  • 7.  Re: XOG and autonumbering Status Reports

    Posted 04-13-2017 06:48 AM

    Sorry to say it did not work for me. It created a new instance with ID -1.

    Aurorar's solution worked for me.

    There are other threads with problems with outnumbered items.



  • 8.  Re: XOG and autonumbering Status Reports

    Posted 04-13-2017 07:27 AM

    I tried to replicate similar scenario and was able to reproduce this same.

    you might need to check few things.

    1) Autonumber is enabled for that field.

    2) There should not be any object instance with -1 ID already present as it will try to XOG in that instead of creating a new one.

     

    So i will suggest you to try by deleting this instance.

    Please find below xog which i used to check on Status Report of a particular project.

     

    <NikuDataBus>
    <Header action="write" externalSource="NIKU" objectType="customObjectInstance" version="15.2.0.213">
    <args name="overrideAutoNumbering" value="false"/>
    </Header>
    <customObjectInstances objectCode="cop_prj_statusrpt">
    <instance instanceCode="-1" objectCode="cop_prj_statusrpt" parentInstanceCode="TVP00005" parentObjectCode="project">
    <CustomInformation>
    <ColumnValue name="cop_cost_effort_ext">false</ColumnValue>
    <ColumnValue name="name">Status 001</ColumnValue>
    <ColumnValue name="cop_report_date">2017-04-10T00:00:00</ColumnValue>
    <ColumnValue name="cop_cost_effort_rev">false</ColumnValue>
    <ColumnValue name="cop_sched_milestone">false</ColumnValue>
    <ColumnValue name="code">-1</ColumnValue>
    <ColumnValue name="cop_scope_deliver">false</ColumnValue>
    <ColumnValue name="odf_parent_id">5005002</ColumnValue>
    <ColumnValue name="odf_cncrt_parent_id">5005002</ColumnValue>
    <ColumnValue name="cop_cost_eft_staff">false</ColumnValue>
    <ColumnValue name="cop_scope_change">false</ColumnValue>
    <ColumnValue name="cop_scope_obj">false</ColumnValue>
    <ColumnValue name="partition_code">NIKU.ROOT</ColumnValue>
    </CustomInformation>
    <OBSAssocs complete="false"/>
    <Security>
    <UserSecurity rightCode="odf_cst_cop_prj_statusrpt_edit" userName="admin"/>
    </Security>
    </instance>
    </customObjectInstances>
    </NikuDataBus>

     

    Let me know if it work for you

     

    Regard, 

    Prashank Singh



  • 9.  Re: XOG and autonumbering Status Reports

    Posted 04-07-2017 07:49 AM

    Thanks again Aurora_Gaimon 

    Now I'm using it for baselines. 

    Why might I be getting autonumbered ID up by 2 every time when I run the script?

    Does it matter?

     

    <!-- Get the next autonumber for Revision ID -->

    <sql:update escapeText="false" var="autonumbercode">
    <![CDATA[DECLARE
    P_OBJECT_CODE VARCHAR2(200);
    P_ATTRIBUTE_CODE VARCHAR2(200);
    P_PARTITION_CODE VARCHAR2(200);
    P_TABLE_NAME VARCHAR2(200);
    P_COLUMN_NAME VARCHAR2(200);
    P_PARENT_REFERENCE_ATTR VARCHAR2(200);
    P_PARENT_PK NUMBER;
    P_NEXT_ID VARCHAR2(200);
    BEGIN
    P_OBJECT_CODE := 'baseline';
    P_ATTRIBUTE_CODE := 'code';
    P_PARTITION_CODE := 'NIKU.ROOT';
    P_TABLE_NAME := 'PRJ_BASELINES';
    P_COLUMN_NAME := 'code';
    P_PARENT_REFERENCE_ATTR := '';
    P_PARENT_PK := 5000000;


    CMN_AUTONUM_GET_NEXT_SP(
    P_OBJECT_CODE => P_OBJECT_CODE,
    P_ATTRIBUTE_CODE => P_ATTRIBUTE_CODE,
    P_PARTITION_CODE => P_PARTITION_CODE,
    P_TABLE_NAME => P_TABLE_NAME,
    P_COLUMN_NAME => P_COLUMN_NAME,
    P_PARENT_REFERENCE_ATTR => P_PARENT_REFERENCE_ATTR,
    P_PARENT_PK => P_PARENT_PK,
    P_NEXT_ID => P_NEXT_ID
    );
    /* Legacy output: */
    DBMS_OUTPUT.PUT_LINE('P_NEXT_ID = '|| P_NEXT_ID);

    -- P_NEXT_ID = P_NEXT_ID;
    --rollback;
    END;]]>
    </sql:update>


    <!-- Query for the next autonumber Revision ID -->

    <sql:query escapeText="False" var="new_autonum_code">
    <![CDATA[
    SELECT next_value next_value_id
    FROM CMN_AUTONUM_SCHEMES
    WHERE 1=1
    AND object_code = 'baseline'
    AND attribute_code = 'code'
    AND partition_code = 'NIKU.ROOT'
    ]]>
    </sql:query>
    <core:forEach items="${new_autonum_code.rowsByIndex}" var="varRow0">
    <core:set value="${varRow0[0]}" var="next_value_id"/>
    <gel:log> Baseline next_value_id: ${next_value_id}</gel:log>
    </core:forEach>



  • 10.  Re: XOG and autonumbering Status Reports

    Posted 04-13-2017 08:49 AM

    Sorry to say I already have a solution that works me.

    Your version is different from mine.



  • 11.  Re: XOG and autonumbering Status Reports

    Posted 04-07-2017 10:09 AM

    In order to speed up the process, CA PPM internally caches the IDs, and because of that you may not get the exact increment by one, you may get ID from that cached pool.

    And auto numbering doesn't works with some of the OOTB objects, like if you try to create a company or a project via XOG you may face this issue.



  • 12.  Re: XOG and autonumbering Status Reports

    Posted 04-08-2017 12:05 PM

    Thanks, so you say it is standard functionality and then the answer to the second question is. "It does not matter"