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

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
    ACCEPTED ANSWER

    Re: How to display section headings from level 1

    ‏2011-09-14T06:41:54Z  in response to ashokanumula
    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
      ACCEPTED ANSWER

      Re: How to display section headings from level 1

      ‏2011-09-14T14:33:01Z  in response to Peter_Albert
      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
        ACCEPTED ANSWER

        Re: How to display section headings from level 1

        ‏2011-09-14T14:49:25Z  in response to ashokanumula

        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
          ACCEPTED ANSWER

          Re: How to display section headings from level 1

          ‏2011-09-14T15:18:44Z  in response to SystemAdmin
          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
            ACCEPTED ANSWER

            Re: How to display section headings from level 1

            ‏2011-09-14T16:36:22Z  in response to ashokanumula
            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
              ACCEPTED ANSWER

              Re: How to display section headings from level 1

              ‏2011-09-14T18:12:19Z  in response to kbmurphy
              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
        2809 Posts
        ACCEPTED ANSWER

        Re: How to display section headings from level 1

        ‏2011-09-14T18:20:08Z  in response to ashokanumula

        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
          ACCEPTED ANSWER

          Re: How to display section headings from level 1

          ‏2011-09-14T19:07:38Z  in response to llandale
          Thanks Louie. This is what exactly I am looking for.
        • dacapri
          dacapri
          9 Posts
          ACCEPTED ANSWER

          Re: How to display section headings from level 1

          ‏2013-10-29T08:42:08Z  in response to llandale

          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
            25 Posts
            ACCEPTED ANSWER

            Re: How to display section headings from level 1

            ‏2013-10-29T09:14:40Z  in response to dacapri

            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