1 Reply Latest reply: Apr 4, 2014 2:45 PM by user9976634 RSS

    Documaker alignment by decimal point




      We're facing an issue that requires us to align fields by their decimal points.


      The fields are retrieved via: data = SrchData("!/XML/entity/entityBody/entityTxnBodySection/s1/itemInfo["&#s1UnitPrice&"]/unitPrice", 1,15)

      and then data is formatted via:  data = Trim(Format(data_u1,"n","ZZZ,ZZZ,ZZZ,ZZZ,ZZZ,ZZ9.99999999"))

      The data is then put into the field via CALL('functionHere'), MODE=C,XPOS=0,ARCH=.,RULE=DAL


      This will result in just a center justified field.


      We've also tried putting JUSTFIELD("R", 0, ".","fieldName") into the DAL but it still hasn't worked. Even with a ~DAL field in the section.


      Any help would be much appreciated. Thank you!




        • 1. Re: Documaker alignment by decimal point

          According to the help for the JustField() function in DAL:

          "You must define the X-coordinate parameter when using the justification character. If you omit the X-coordinate the system runs as if the justification character was not specified."

          Therefore you second parameter 0 would be the problem.


          However, your next question is: "You mean I have to go figure out the exact FAP point where I want the alignment? What a pain!".


          You could actually employ the FieldX() function to help you in that regards. If you make sure that your fields are aligned on the left edge, then you could add a fixed amount to that value and know that all your content aligns on the decimal accordingly.


          Now, your format is pretty large, so let's assume that means about 2 inches of space is needed. That would be 4800 FAP units.

          The script then would do something like this:


          #pos = FieldX("fieldName1") + 4800

          JUSTFIELD("R", #pos, ".","fieldName1")

          JUSTFIELD("R", #pos, ".","fieldName2")

          JUSTFIELD("R", #pos, ".","fieldName3")



          Since all your fields in this sequence should have the same left coordinate, you do not have to recalculate #pos but can instead reuse the same value for each one.