Topic
  • 11 replies
  • Latest Post - ‏2013-10-29T14:32:04Z by dacapri
ashokanumula
ashokanumula
26 Posts

Pinned topic How to display section headings from level 1

‏2011-09-13T20:28:32Z |
I am new to dxl scripting. Here is my requirement.

I have to search in Module for perticular attribute, say “ Ready for Review”
Then I have to display the parent object headings till level 1 of that object.

This is to find the section from top level in which “Ready for Review” requiremnts are present.

Thanks in advance

Ashok Anumula
Updated on 2011-09-14T19:07:38Z at 2011-09-14T19:07:38Z by ashokanumula
  • Peter_Albert
    Peter_Albert
    250 Posts

    Re: How to display section headings from level 1

    ‏2011-09-14T06:41:54Z  
    No DXL needed here. Define a filter for the attribute in question. In the filter dialogue box, click the "Advanced" button and select "Show ancestors". This gives you all parent object for all filtered objects.

    Regards,

    Peter
  • ashokanumula
    ashokanumula
    26 Posts

    Re: How to display section headings from level 1

    ‏2011-09-14T14:33:01Z  
    No DXL needed here. Define a filter for the attribute in question. In the filter dialogue box, click the "Advanced" button and select "Show ancestors". This gives you all parent object for all filtered objects.

    Regards,

    Peter
    Peter, I know that applying filter and "show ancestors" will give the all parent object headings. But I want to use dxl to print all parent headings till top level into a text file or xls file. Reviewer for each section is different. I want to track reviewing activity by this.

    I want to get output as mentioned below

    For Ex: There are 5 "Requirements to be Reviewed" in section 4.2.2.16.1.1
    the output should be

    4.0 Object Heading 4.2 Object Heading 4.2.2 Object Heading 4.2.2.16 Object Heading 4.2.2.16.1 Object Heading 4.2.2.16.1.1 Object Heading "Requirements to be Reviewed" Count: 5

    Any help will be greatly appreciated.
    Regards,
    Ashok Anumula
  • SystemAdmin
    SystemAdmin
    3180 Posts

    Re: How to display section headings from level 1

    ‏2011-09-14T14:49:25Z  
    Peter, I know that applying filter and "show ancestors" will give the all parent object headings. But I want to use dxl to print all parent headings till top level into a text file or xls file. Reviewer for each section is different. I want to track reviewing activity by this.

    I want to get output as mentioned below

    For Ex: There are 5 "Requirements to be Reviewed" in section 4.2.2.16.1.1
    the output should be

    4.0 Object Heading 4.2 Object Heading 4.2.2 Object Heading 4.2.2.16 Object Heading 4.2.2.16.1 Object Heading 4.2.2.16.1.1 Object Heading "Requirements to be Reviewed" Count: 5

    Any help will be greatly appreciated.
    Regards,
    Ashok Anumula

    Well, you have an object o for which you want to display the heading levels up to level 1, the below code climbs up the levels by using the "parent" function
     

    Object o = current
    Object po = parent o
     
    while (!null po) 
       {
         print po."Object Heading" "\n"
         po = parent po
       }
    

     


    did not test this ;-)

     

    Updated on 2014-01-03T01:35:05Z at 2014-01-03T01:35:05Z by iron-man
  • ashokanumula
    ashokanumula
    26 Posts

    Re: How to display section headings from level 1

    ‏2011-09-14T15:18:44Z  

    Well, you have an object o for which you want to display the heading levels up to level 1, the below code climbs up the levels by using the "parent" function
     

    <pre class="javascript dw" data-editor-lang="js" data-pbcklang="javascript" dir="ltr">Object o = current Object po = parent o while (!null po) { print po."Object Heading" "\n" po = parent po } </pre>

     


    did not test this ;-)

     

    Pekka, I have used this script. It will print Object Headings from Low to High. But I want to print Headings from High to Low. i.e from level 1.

    Any logic in the script is appreciated.
  • kbmurphy
    kbmurphy
    160 Posts

    Re: How to display section headings from level 1

    ‏2011-09-14T16:36:22Z  
    Pekka, I have used this script. It will print Object Headings from Low to High. But I want to print Headings from High to Low. i.e from level 1.

    Any logic in the script is appreciated.
    Set you filter with ancestors, or just turn on Outlining (View>Outline, I believe).

    File>Export>Plain Text or Office>Word or Excel or what have you.

    If you really want DXL, it's simple. After the filter and outlining have been set:

    //code start
    Object o
    Module m = current

    for o in m do
    print o."Object Heading" "\n"
    //code end
  • ashokanumula
    ashokanumula
    26 Posts

    Re: How to display section headings from level 1

    ‏2011-09-14T18:12:19Z  
    • kbmurphy
    • ‏2011-09-14T16:36:22Z
    Set you filter with ancestors, or just turn on Outlining (View>Outline, I believe).

    File>Export>Plain Text or Office>Word or Excel or what have you.

    If you really want DXL, it's simple. After the filter and outlining have been set:

    //code start
    Object o
    Module m = current

    for o in m do
    print o."Object Heading" "\n"
    //code end
    It's very complex to set filter for each sub section where requirements ready for review are present. I want to automate with dxl script which give output as

    4.0 Object Heading 4.2 Object Heading 4.2.2 Object Heading 4.2.2.16 Object Heading 4.2.2.16.1 Object Heading 4.2.2.16.1.1 Object Heading "Requirements to be Reviewed" Count: 5

    if requirements ready for review are in section 4.2.2.16.1.1.

    Thanks
  • llandale
    llandale
    2986 Posts

    Re: How to display section headings from level 1

    ‏2011-09-14T18:20:08Z  
    Peter, I know that applying filter and "show ancestors" will give the all parent object headings. But I want to use dxl to print all parent headings till top level into a text file or xls file. Reviewer for each section is different. I want to track reviewing activity by this.

    I want to get output as mentioned below

    For Ex: There are 5 "Requirements to be Reviewed" in section 4.2.2.16.1.1
    the output should be

    4.0 Object Heading 4.2 Object Heading 4.2.2 Object Heading 4.2.2.16 Object Heading 4.2.2.16.1 Object Heading 4.2.2.16.1.1 Object Heading "Requirements to be Reviewed" Count: 5

    Any help will be greatly appreciated.
    Regards,
    Ashok Anumula

    Don't think this is exactly what you asked for but its close:

    void PrintHeadings(Object o, int &Depth)
    {    // RECURSIVE
            if (null o) return
            Object oParent = parent(o)
            PrintHeadings(oParent, Depth)   // RECURSION
            string  Heading = o."Object Heading"
            if (!null Heading) //
            then print number(o) "\t" Heading "\t"
            else print number(o) "\t" (o."Object Text") "\t"
            Depth++
    }
     
    void    PrintHeadings(Object o)
    {     // Entry function
     
            int     Depth = 0
            PrintHeadings(o, Depth)
            if (Depth > 0) print "Count = " Depth "\n"
    }
     
    PrintHeadings(current Object)
    

     

    • Louie

     

    Updated on 2014-01-03T01:35:46Z at 2014-01-03T01:35:46Z by iron-man
  • ashokanumula
    ashokanumula
    26 Posts

    Re: How to display section headings from level 1

    ‏2011-09-14T19:07:38Z  
    • llandale
    • ‏2011-09-14T18:20:08Z

    Don't think this is exactly what you asked for but its close:

    <pre class="javascript dw" data-editor-lang="js" data-pbcklang="javascript" dir="ltr">void PrintHeadings(Object o, int &Depth) { // RECURSIVE if (null o) return Object oParent = parent(o) PrintHeadings(oParent, Depth) // RECURSION string Heading = o."Object Heading" if (!null Heading) // then print number(o) "\t" Heading "\t" else print number(o) "\t" (o."Object Text") "\t" Depth++ } void PrintHeadings(Object o) { // Entry function int Depth = 0 PrintHeadings(o, Depth) if (Depth > 0) print "Count = " Depth "\n" } PrintHeadings(current Object) </pre>

     

    • Louie

     

    Thanks Louie. This is what exactly I am looking for.
  • dacapri
    dacapri
    11 Posts

    Re: How to display section headings from level 1

    ‏2013-10-29T08:42:08Z  
    • llandale
    • ‏2011-09-14T18:20:08Z

    Don't think this is exactly what you asked for but its close:

    <pre class="javascript dw" data-editor-lang="js" data-pbcklang="javascript" dir="ltr">void PrintHeadings(Object o, int &Depth) { // RECURSIVE if (null o) return Object oParent = parent(o) PrintHeadings(oParent, Depth) // RECURSION string Heading = o."Object Heading" if (!null Heading) // then print number(o) "\t" Heading "\t" else print number(o) "\t" (o."Object Text") "\t" Depth++ } void PrintHeadings(Object o) { // Entry function int Depth = 0 PrintHeadings(o, Depth) if (Depth > 0) print "Count = " Depth "\n" } PrintHeadings(current Object) </pre>

     

    • Louie

     

    Hello,

    I found this topic when looking for the following.

    I need to have the attribute Object Heading and Object Text (the combined one) exactly as shown normally (heading with section numbers and bold font + object text) but not editable by any users.

    I thought that a LayoutDXl attribute was the good choice and using a simple :

    display obj."Object Heading"
    display obj."Object Text"

    I got what I need but no way to show properly the headings.

    Is there any way to show the heading numbers and the characters in bold?

    Thanks a lot in advance.

  • PRM
    PRM
    33 Posts

    Re: How to display section headings from level 1

    ‏2013-10-29T09:14:40Z  
    • dacapri
    • ‏2013-10-29T08:42:08Z

    Hello,

    I found this topic when looking for the following.

    I need to have the attribute Object Heading and Object Text (the combined one) exactly as shown normally (heading with section numbers and bold font + object text) but not editable by any users.

    I thought that a LayoutDXl attribute was the good choice and using a simple :

    display obj."Object Heading"
    display obj."Object Text"

    I got what I need but no way to show properly the headings.

    Is there any way to show the heading numbers and the characters in bold?

    Thanks a lot in advance.

    Try the following in a DXL Layout Column:

    if (obj."Object Heading" "" != "")  {
    font(getCanvas, level(obj), HeadingsFont)
    displayRich(number(obj) " " obj."Object Heading" "")
    }
     
    if (obj."Object Text" "" != "") {
    font(getCanvas, level(obj), TextFont)
    displayRich(richTextWithOle(obj."Object Text"))
    }

    BTW - it's been a while since I was on Developer Works and have not fully mastered the new forum features - are there some special tags for DXL code so that it appears in a syntax highlighted format

    Paul Miller
    Melbourne Australia

    Updated on 2013-10-29T09:15:16Z at 2013-10-29T09:15:16Z by PRM
  • dacapri
    dacapri
    11 Posts

    Re: How to display section headings from level 1

    ‏2013-10-29T14:32:04Z  
    • PRM
    • ‏2013-10-29T09:14:40Z

    Try the following in a DXL Layout Column:

    if (obj."Object Heading" "" != "")  {
    font(getCanvas, level(obj), HeadingsFont)
    displayRich(number(obj) " " obj."Object Heading" "")
    }
     
    if (obj."Object Text" "" != "") {
    font(getCanvas, level(obj), TextFont)
    displayRich(richTextWithOle(obj."Object Text"))
    }

    BTW - it's been a while since I was on Developer Works and have not fully mastered the new forum features - are there some special tags for DXL code so that it appears in a syntax highlighted format

    Paul Miller
    Melbourne Australia

    Hello Paul,

    Thanks a lot for you  solution. it works perfectly but I discovered another problem with changebar and linkindicatiors:

    https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014448295

     

    Regards,

    Daniele