1 Reply Latest reply on May 18, 2015 4:15 PM by philmodjunk

    script help

    AdamReed_1

      Title

      script help

      Post

      I'm relatively new to scripting, and so have minimal skill.

      I have a number of payments that are due based on a contract.  When a particular payment is received, I run the attached script to generate a record in a disbursement table -- fields in that table run some simple calculations to give a bookkeeper instructions on how to issue that particular payment, and once a payment receives a disbursement id it is considered paid.

      There are cases, however, in which a payment is split between more than one client.  In those cases the payment may be split evenly or not, expenses may be applied to one client and not the other, etc., so the calculations really have to be applied to the particular client's share.  Thus, I would like to generate multiple records in the disbursement table (one for each client) that share a payment id.

      I've created the attached script, which works well, however does not separate multiple authors who may share payments.

      I believe what I want to do is create a loop that looks at successive portal rows in a related record in the author share table, and the creates new disbursement layouts if a portal row is not empty create a new disbursement sheet.  I don't really know the details of how to do this.

      Just let me know, of course, if more information would be helpful, and thanks very much for any help.

      Adam

      disbursement_script.png

        • 1. Re: script help
          philmodjunk

          It looks like your current script will run the same even if you remove the go to portal row step. I suppose it might cause the row to highlight as active if it is not already so highlighted, but that's about it for that step. (You can't get the active portal row number until you are already on the active portal row so you are telling the script to go to the portal row where it is already at.)

          Instead of looping through portal rows, it's a bit better to either pull up a found set of authors using Go To Related records or generate a list of ID's in a variable and then loop through those variables or records.

          Much depends on your underlying data model which you do not share in your original post. One key question is whether all co-authors equally share in every such payment or if there are cases where one author gets a larger piece of the payment than a co-author.