4 Replies Latest reply: May 15, 2014 8:16 PM by User9976634-Oracle RSS

    Letter-bullets triggered by groups?

    madson

      Howdy!

       

      I am in the need of a relatively straightforward letter-generating bulletpoint on a repeating Section in Oracle Documaker.  The range is a maximum of 26 letters (limited to the alphabet, of course). The difficulty comes in that I need to print the next letter of the alphabet only when the XML shows a change in a specific related field (FullLimit).  The catch is that this field will be user-generated and therefore will vary. 

       

      Please help me write a DAL script that will only print the next letter after each change in my XML data! 

       

      :: Sample XML Data Nodes ::

       

      <Insurance>

        <InsName>Alpha Insurance</InsName>

        <Coverage>

          <Option>

            <OptTypeCode>UnderLimit</OptTypeCode>

            <OptValue>7000000</OptValue>

          </Option>

          <Option>

            <OptTypeCode>FullLimit</OptTypeCode>

            <OptValue>10000000</OptValue>

          </Option>

        </Coverage>

      </Insurance>

      <Insurance>

        <InsName>Bravo Insurance</InsName>

        <Coverage>

          <Option>

            <OptTypeCode>UnderLimit</OptTypeCode>

            <OptValue>2000000</OptValue>

          </Option>

          <Option>

            <OptTypeCode>FullLimit</OptTypeCode>

            <OptValue>10000000</OptValue>

          </Option>

        </Coverage>

      </Insurance>

      <Insurance>

        <InsName>Charlie Insurance</InsName>

        <Coverage>

          <Option>

            <OptTypeCode>UnderLimit</OptTypeCode>

            <OptValue>5000000</OptValue>

          </Option>

          <Option>

            <OptTypeCode>FullLimit</OptTypeCode>

            <OptValue>8000000</OptValue>

          </Option>

        </Coverage>

      </Insurance>

      <Insurance>

        <InsName>Delta Insurance</InsName>

        <Coverage>

          <Option>

            <OptTypeCode>UnderLimit</OptTypeCode>

            <OptValue>1000000</OptValue>

          </Option>

          <Option>

            <OptTypeCode>FullLimit</OptTypeCode>

            <OptValue>8000000</OptValue>

          </Option>

        </Coverage>

      </Insurance>

      <Insurance>

        <InsName>Echo Insurance</InsName>

        <Coverage>

          <Option>

            <OptTypeCode>UnderLimit</OptTypeCode>

            <OptValue>4000000</OptValue>

          </Option>

          <Option>

            <OptTypeCode>FullLimit</OptTypeCode>

            <OptValue>5000000</OptValue>

          </Option>

        </Coverage>

      </Insurance>

       

      This XML should produce the following output:

       

      A.

      Insurance Name: Alpha Insurance

      $7,000,000 part of $10,000,000

       

      Insurance Name: Bravo Insurance

      $2,000,000 part of $10,000,000

       

      B.

      Insurance Name: Charlie Insurance

      $5,000,000 part of $8,000,000

       

      Insurance Name: Delta Insurance

      $1,000,000 part of $8,000,000

       

      C.

      Insurance Name: Echo Insurance

      $4,000,000 part of $5,000,000

       

       

      I'm imagining that this is my referential XPath but I'd need a variable for OptValue: !/Insurance/Coverage/Option[OptTypeCode='FullLimit'][OptValue=???]

       

      Here is a great little script that I inherited for iteratively making bullet-point letters:

       

      Letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

       

      setgvm("LetterCount",gvm("LetterCount")+1,,"S",2)

       

      if gvm("LetterCount") < 27

         letter=sub(Letters,gvm("LetterCount"),1)

      else

         letter="?"

      end

       

      return letter & "."

       

      But this will trigger for each instance of data.  Thoughts on how to begin? 

        • 1. Re: Letter-bullets triggered by groups?
          User9976634-Oracle

          I'm not sure I understand if you are asking how to trigger the sections or just to get your bullet letter values. If these are truly on repeating sections, and depending upon the version of the software you are using, you could do this.

           

          Assign your field with the rule set as DAL. Then have the data be: CALL("IndexCount")

           

          Your IndexCount.DAL script could then look something like this - which achieves the a result similar to what you have above:

           

          x = SECTIONNAME();

          #r = CFIND(x, "\")

          if (#r > 0)

              #r = SUB(x, #r+1)

          else

          #r = 1

          end

          if (#r > 26)

            #r = 27

          end

          RETURN(SUB("ABCDEFGHIJKLMNOPQRSTUVWXYZ?", #r, 1) & ".")

           

          Repeating sections on a form will return a name with an index. So each field on the separate sections will get a SectionName return like this: MySection, MySection\2, MySection\3, MySection\4, etc. So if you don't find a backslash in the name, you know it is the first occurrence. If you do, then the text following the backslash is the count of that repeated section within the form.  Add a safety check for running past 26 and then you return your bullet text. The value is assigned to the field.

          • 2. Re: Letter-bullets triggered by groups?
            madson

            The sections are already being triggered separately.  That part is working fine.  This is just to get the bullet values to work correctly.

             

            Let me try this code out...

            • 3. Re: Letter-bullets triggered by groups?
              madson

              I'm running on Oracle Documaker 11.5.

               

              Ok, so copy & pasting your code into a new indexcount.dal file, I rename SECTIONNAME to my section name (in this case it's QBEX_0114_BODY08):

               

                   x = QBEX3000_0314_BODY08();

                   #r = CFIND(x, "\")

                   if (#r > 0)

                       #r = SUB(x, #r+1)

                   else

                   #r = 1

                   end

                   if (#r > 26)

                     #r = 27

                   end

                   RETURN(SUB("ABCDEFGHIJKLMNOPQRSTUVWXYZ?", #r, 1) & ".")

               

              Then I load my sample XML file and it errors out on me.  My errfile.dat says:

               

                   DM12041:  Error : FAP library error: Transaction:<QPLBDNEW12>, area:</home/fap/rel115/rps100/dallib/unix/../c/daerrors.c,Jun  9 2010 16:40:37,11,5,1,184>

                        code1:<0>, code2:<0> msg:<Script: /qbeapps/print/mstrres/dcpd/deflib/indexcount.dal

                   Line: 1  Col: 5  Err: 6  Token: QBEX3000_0314_BODY08  Msg: Invalid or unknown symbol>.

                   DM10553:  Error in DAL: Unable to DALRunScript(NULL,<CALL("INDEXCOUNT")>,,,).

                   DM12051:  Error in RPProcessOneField(): Unable to <DAL>(). Current Image is <QBEX3000_0114_BODY08>.

                   DM12048:  Error in RPProcessFields(): Unable to RPProcessOneField(pRPS) <BULLETLETTER>. Processing will  continue for image <QBEX3000_0114_BODY08>. See INI group:< GenDataStopOn > option:      FieldErrors.

                   DM12041r  Error : FAP library error: Transaction:<QPLBDNEW12>, area:</home/fap/rel115/rps100/dallib/unix/../c/daerrors.c,Jun  9 2010 16:40:37,11,5,1,184>

                   r : FAP library error: Transaction:<QPLBDNEW12>, area:</home/fap/rel115/rps100/dallib/unix/../c/daerrors.c,Jun  9 2010 16:40:37,11,5,1,184>

                        code1:<0>, code2:<0> msg:<Script: /qbeapps/print/mstrres/dcpd/deflib/indexcount.dal

                   Line: 1  Col: 5  Err: 6  Token: QBEX3000_0314_BODY08  Msg: Invalid or unknown symbol>.

               

              Hmm.  Obviously much of this is custom scripting, unique to my system -- but "Invalid or unknown symbol"?  Any idea what this might be referring to?

              • 4. Re: Letter-bullets triggered by groups?
                User9976634-Oracle

                Sorry, SectionName() is not your "section name", that is a DAL function. However, in your version it was called ImageName(). So change that line back to

                 

                x = ImageName();

                 

                And that will return your section name.

                 

                This points out that it is important to mention your version when posting questions. Sometimes the answer will vary with the version.