• 1 reply
  • Latest Post - ‏2013-05-16T15:11:45Z by llandale
112 Posts

Pinned topic Copying the part of the content attribute Object Heading and text content into the new attribute

‏2013-05-16T12:56:52Z | doors; dxl dxl;

Hello All,

I need to copy the part of the content in attribute "Object Heading and "Object Text" into a newly created attribute.

I am able to copy the whole text in the particular attribute but not able to copy the part of the content into a new attribute.

For e.g: Object Heading and Object Text attribute contains "CR-4444_New CR". But i need to copy only the content "CR-4444" to newly created attribute.

Information can be taken from main object (level 1) and then filled in to level 1, 2, 3, … lines for each CR.(Consider there are many CRs in a module)

Can any one please give me suggestion in DXL Scripting. I am finding trouble in copying the content of the attribute into new attribute as it is copying the data of the top most level into all the objects in module(But it should copy the data from the each CR top row to the respective levels of the CR)



  • llandale
    3035 Posts

    Re: Copying the part of the content attribute Object Heading and text content into the new attribute


    This looks familiar; I think I wrote some code that may copy the "CR-nnnn" part to the new attribute for the current object only ... or at least wrote some code that could get you going.

    I don't understand what you are talking about vis-a-vis "Levels" of the CR.  I'm guessing that when such a "CR-nnnn" tag is applied to an object then that CR applies to all children objects of that object.

    • CR-0001_whatever
      • dd                        // CR-0001 applies here
        • ee           // CR-0001 applies here also
    • Next                                   // No CR applies here

    If so, you can recursively apply a CR to children and grand-children as follows:


    • Skip g_skpApplied = create()   // KEY and DATA both 'Object', when that object has a CR applied to it
    • void Apply_CR(Object obj, string CR)
    • {  // Apply this CR to the object and all it's children
    •    if (null obj) return
    •    if (find(g_skpApplied, obj)) then {ERROR; Object already has CR applied???; return}
    •    put(g_skpApplied, obj)
    •    obj."NameAttrCR" = CR    // Apply the CR to this object
    •                         // Now apply to child objects:
    •    Object oChild
    •    for oChild in obj do
    •    {  if (isDeleted(oChild)                      continue // Ignore Deleted objects
    •       if (table(oChild) or row(oChild) or cell(oChild)) continue // Ignore objects in Tables
    •       Apply_CR(oChild, CR)    // *** RECURSION ***
    •    } // end for child objects
    • }   // end Apply_CR()