Clarity

Expand all | Collapse all

XOG-in and auto-numbering attributes

  • 1.  XOG-in and auto-numbering attributes

    Posted Oct 12, 2010 07:07 AM
    HiI have a custom object and the CODE for it  has enabled the  autonumbering flag.  I want to create a new instance of that object using XOG.  How can I do it without specifying the CODE?I want that Clarity auto-genere the CODE for new objects  Thank you


  • 2.  Re: XOG-in and auto-numbering attributes - New info

    Posted Oct 12, 2010 07:07 AM
    Just thought I'd pass this along.....  Credit goes to Ramesh Rathnam, a CA Senior Consultant.  When using XOG to create sub-objects, with autonumbering enabled for the Name and/or ID.Previously I had hit a wall because, even when omitting the Name and ID values, it was still required to provide a unique instanceCode value.   My whole intent was to rely on autonumbering to take care of any object uniqueness for me.   Paul Maxwell's sample got me started, but Ramesh provided the information to get me through the final mile.  1) the correct syntax to utilize auto numbering is - overrideAutoNumbering="0"2) you still need to include the parameter instanceCode, but use a -1 for the value.  
      overrideAutoNumbering="0" />
         
              instanceCode="-1" objectCode="[sub_object_code]" parentInstanceCode="[parent_ID]" parentObjectCode="[parent_obj_type]">

    [sub-object attributes and values]

             
            I've tested this and it works great.I would presume, but I haven't tried it, that you can omit the parentInstanceCode and parentObjectCode parameters if you are dealing with top level object.Thanks again to Paul and Ramesh  


  • 3.  Re: XOG-in and auto-numbering attributes - New info

    Posted Oct 12, 2010 07:07 AM
    Great to hear this has been resolved - however this feature should be using "true" or "false" I believe. A support case may help as I don't believe you should be using cryptic "1" or "0" for an option of this sort. See the attached image.    


  • 4.  Re: XOG-in and auto-numbering attributes - New info

    Posted Oct 12, 2010 07:07 AM
    Ordinarily I'd agree with you, however, using "false" did not work for me, and the suggestion to use "0" came from a CA Senior Consultant.I still have to develop a few other XOG's that will require this technique.   I'll try and use "false" where I can make it work, but I know that "0" does work.  ThanksB


  • 5.  Re: XOG-in and auto-numbering attributes - New info

    Posted Oct 12, 2010 07:07 AM
    Sorry - what I was suggesting is that you create a support case - becuse it should work with "true" and "false" (it is documented that way) - feel free to use the image along with your support case.  You will be doing yourself, and all others, a favor by having this recorded formally via the support case. [PS: at the very least this is a documentation bug, but I believe you should be able to use "true" or "false"]  I'm very pleased you have a workaround (thanks Ramesh!) - and it's really good to know that option is available, but, see above :-)


  • 6.  Re: XOG-in and auto-numbering attributes - New info

    Posted Oct 12, 2010 07:07 AM
    ah, understood.   at the moment, though, i've got more important fires to put out that requires tech support's attention, but i'll keep this one on the to do list.Thanks againB  


  • 7.  Re: XOG-in and auto-numbering attributes - New info

    Posted Oct 12, 2010 07:07 AM
    FWIW, after the upgrade to 12.0SP4, I was able to use "false" instead of "0" per the CA recommendation.  


  • 8.  RE: Re: XOG-in and auto-numbering attributes - New info

    Posted Apr 29, 2011 02:56 AM
    Hello,

    overrideAutoNumbering="false" or overrideAutoNumbering="0" works fine for auto-numbering the column "Code" i.e. Attribute ID = unique_code with XOG write.

    A custom attribute having autonumber set, the XOG write does not populate the value of that custom attributes automatically.

    Has anyone else experienced the same?

    Thank you.
    M


  • 9.  Re: XOG-in and auto-numbering attributes
    Best Answer

    Posted Oct 12, 2010 07:07 AM
    In Clarity v12 the following has been introduced:   Autonumbering and Custom Attributes
    The flag overrideAutoNumbering is defined on the XOG header and determines whether source XOG content overrides autonumbering in the target content. The flag is available for the custom attributes of stock and custom objects.
    The following rules apply: If the flag is set to TRUE, XOG content from the source is applied to the target. If the flag is set to FALSE, the autonumbering scheme defined on the target is applied. The flag is specified in the XOG export file. By default, OverrideAutoNumbering=TRUE.   soif OverrideAutoNumbering is TRUE ...your XOG file must supply the valueif OverrideAutoNumbering is FALSE .then the autonumber scheme is applied   In Clarity v8:  for Ideas if you omit the ID from a XOG file a new instance is created with an autonumbered idFor Projects this is not true and you have to supply the ID in the XOG file.          


  • 10.  Re: XOG-in and auto-numbering attributes

    Posted Oct 12, 2010 07:07 AM
    Thank you maxad.  Your solution works fine for me.  Let me ask you, where can I find a XOG  documentation or guide updated that shows all the possible attribute and the explanation for each one?  The Integration Guide document the CA provide is not complete.


  • 11.  Re: XOG-in and auto-numbering attributes

    Posted Oct 12, 2010 07:07 AM
    I I believe the XOG related documentation was revised for v12 - I will check on the status of this and report back    


  • 12.  Re: XOG-in and auto-numbering attributes

    Posted Oct 12, 2010 07:07 AM
     In my (Oracle) 7.5.1/8.1 world.......for any objects that are using Clarity autonumbering, the application generates the "next number" using a database procedure;   CMN_AUTONUM_GET_NEXT_SP   So you can call that same procedure externally (but how you do that is up to you, I don't know how you are generating you XOG file) to give you a new unique sequenced number that you can then use in your XOG.    Look at the procedure's code to work out how to use it; I call it to get me the next "Risk" autonumber from Oracle PL/SQL like this;  CMN_AUTONUM_GET_NEXT_SP (P_OBJECT_CODE => 'risk' ,P_ATTRIBUTE_CODE => 'rim_risk_issue_code',P_PARTITION_CODE = 'NIKU.ROOT',P_NEXT_ID => l_risk_code );  and that returns me the next Risk ID into my local variable "l_risk_code"which I then use in my XOG....  "Your experience may vary" of course depending on your object/attribute/partition/database/usage!  Dave.


  • 13.  Re: XOG-in and auto-numbering attributes

    Posted Oct 12, 2010 07:07 AM
    Dave,Thank you for your reply.Is good to know what are the  SP for.I tested it and works!


  • 14.  Re: XOG-in and auto-numbering attributes

    Posted Oct 12, 2010 07:07 AM
    Hi Dave,  We are using 8.1 on MS SQl Server 2005. I can't get the following script to work. Does anybody know what I am missing here.  
     
     
          exec CMN_AUTONUM_GET_NEXT_SP ?,?,?,?,?,?,?,?
            pID: ${projectID}, id = ${pID}


  • 15.  Re: XOG-in and auto-numbering attributes

    Posted Oct 12, 2010 07:07 AM
    Yep, does not support calling stored procedures that return things, i.e. it expects all the parameters to be IN only.  CMN_AUTONUM_GET_NEXT_SP uses an OUT parameter.  


  • 16.  Re: XOG-in and auto-numbering attributes

    Posted Oct 12, 2010 07:07 AM
    Hi Whenkey,      I have also gone through similar situation; I didn’t find any way to store output value returned by this procedure.      EXECUTE CMN_AUTONUM_GET_NEXT_SP           'project' , 'unique_code' , 'NIKU.ROOT' , 'inv_investments' , 'code' , NULL , NULL , @P_NEXT_ID OUTPUT        So I have created another procedure without any output parameter which executes CMN_AUTONUM_GET_NEXT_SP procedure internally and stores value in a temp table.    Now it’s quite easy to execute new procedure which doesn’t return any output in GEL.      ~Sonal


  • 17.  Re: XOG-in and auto-numbering attributes

    Posted Oct 12, 2010 07:07 AM
    Hi Whenkey;  I agree with Sonal - your issue is probably only with teh way that you are trying to call the procedure;   
    exec CMN_AUTONUM_GET_NEXT_SP ?,?,?,?,?,?,?,?   I'm afraid I don't do MSSQL (I'm on Oracle) - that code above looks very Oracle-ish, so I suspect you have just got the way that you "call" a procedure a bit confused.  Sonal's solution sounds OK - but in an Oracle-implementation I would not need to go via an intermediate table, I could just construct an Oracle FUNCTION that called the procedure and then just SELECTed back the results of that function in my GEL-embedded SQL....   Perhaps MSSQL can do this sort of this as well (it should I think!).  --  So to solve your problem, investigate HOW you are calling the routine - that "exec" just looks wrong to me (but as I say, I don't do MSSQL!!!)  Good luck!  Dave.    


  • 18.  Re: XOG-in and auto-numbering attributes

    Posted Oct 12, 2010 07:07 AM
    Hi Whenkey,      That’s exactly rite oracle provide us the capability to call a stored procedure inside a function which is certainly not supported in MS SQL , so creating a temp table is the only option left if you are using SQL Server.      General syntax of call a SP (without any output parameter) inside GEL is                                                                 exec create_temp_table_ta '${item_no}'           ~ Sonal


  • 19.  Re: XOG-in and auto-numbering attributes

    Posted Oct 12, 2010 07:07 AM
    Hi,  i think no need for temp tables,function etc.Just an select statement would do for both oracle and sql server.  In the procedure "CMN_AUTONUM_GET_NEXT_SP"   finally the next   number is updated in the table "CMN_AUTONUM_SCHEMES".so after passing the parameters,go andquery the table.  pass the parameters to the procedure   "CMN_AUTONUM_GET_NEXT_SP" .  Then just pass the "object code" to the table.  select next_value from CMN_AUTONUM_SCHEMES where object_code = '';  cheers,sundar      


  • 20.  Re: XOG-in and auto-numbering attributes

    Posted Feb 25, 2016 10:03 AM

    Hi Dave,

     

    May I ask question on this yours very old post?


    I'm currently "struggling" with the task that I need to get "next_value" for next project ID that I'll XOG in to Clarity.

    I've searched all posts on this topic but still can't execute SP from GEL properly. I've also found that out parameter "next_value"

    can be obtained from some table, so only thing I need is to execute SP from GEL. I've tried EXEC or CALL NIKU.CMN_AUTONUM_GET_NEXT_SP

    in <sql:update> and <sql:query> tags, but no luck.

    Could you please be so kind to share your piece of code please? (We are on Oracle).

     

    Thank you very much,

    Matej



  • 21.  Re: XOG-in and auto-numbering attributes

    Posted Oct 12, 2010 07:07 AM
    Hi All,      I need one help regarding auto numbering, i need to xog custom object name but I couldn’t found OverrideAutoNumbering flag anywhere.  If you could share sample xog file for xogging custom object with auto numbering that will be really helpful.      Thanks in advance.      ~ Sonal


  • 22.  Re: XOG-in and auto-numbering attributes

    Posted Oct 12, 2010 07:07 AM
    Thanks for the reminder (I made a commitment above) about "OverrideAutoNumbering"  Updated XOG docuemntation is  in  Clarity v12: CA_ClarityPPM_IntegrationGuide_ENU.pdf      the only sample I could find (not tested) is attached.      


  • 23.  Re: XOG-in and auto-numbering attributes

    Posted Oct 12, 2010 07:07 AM
    Excellent !!! Thanks a lot Paul, its working absolutely fine [:smileyhappy:]


  • 24.  Re: XOG-in and auto-numbering attributes

    Posted Oct 12, 2010 07:07 AM
    Paul,I must be missing something here.  following the snippet from your posted example....  



         
         
                 
                         
                                  10
                                  10                      
                                  Migrated - 8/6/2009
                                  2009-08-06T00:00:00
                                  Approved
                                  true
                                  2009-08-06T00:00:00
                                  300593
                                  300593
                                  niku.root
                         
                         
                 


     Specifically the red bolded line, I cannot get the XOG to work with instancecode="" , nor can i get it to work by omitting the instancecode parameter.    The error I get is                                 com.niku.union.odf.exception.ODFValidationException: Validation failure. Attribute: code. Cause: required   I understand that by setting the Override AutoNumbering to false, I can omit the and tags as those attrbute are set to auto-number.I do see that the instancecode, code and name are all the same value (i'm sure this is by design, or by virtue of all counters being currently in-sync), however, to me auto-numbering implies that it is not necessary for me (or the application that generates XML) to have to create any kind of unique values for the instancecode parameter as well as name and code.I mean, if i have to consult a table or stored proc to get a unique number for instancecode, then there's pretty much no point in using autonumbering for name and code since i'm having to consult the database for instancecode already.   I was hoping that by using auto-numbering, i can bypass any steps that require me to generate unique values.Or am i missing something?  may or may not be an issue, i'm running 12.0 SP1  Thanks
    BeekerC


  • 25.  Re: XOG-in and auto-numbering attributes

    Posted Oct 12, 2010 07:07 AM
    You do have the "xy_ie_documents" custom object defined correctly in your system with a suitable auto-numbering scheme?  (sorry if thats obvious - just ignore me!)Dave.


  • 26.  Re: XOG-in and auto-numbering attributes

    Posted Oct 12, 2010 07:07 AM
    Fair point Dave, but the short answer to your question is "no", but not applicable - the above code is the exact sample that Paul posted, it's for visual reference.In my system, I manually created a couple of instances of the sub-object, XOG'ed them out.   I modified the output XOG (so I knew the XML constructs and syntax would be correct) in the following ways...1) I added overrideAutoNumbering="false" in the 0000003 and 0000003 as both attributes are auto-numbered4) deleted the block  upon execution of the XOG, i was expecting that a new instance of the subobject would be created where code and name would both be set to 0000009 (that's the next number in sequence).what I don't want to have to do is perform a lookup to manually set instancecode to the value 0000009.  the example makes sense, instancecode is a required parameter, but leaving it to "" and having auto-numbering turned on, would seem to imply that it too will be auto generated.it doesn't seem to be behaving that way.