1 Reply Latest reply on Dec 6, 2013 3:25 PM by philmodjunk

    Use Script or Calculation fields in Database - complicated computation

    BillPlunkett

      Title

      Use Script or Calculation fields in Database - complicated computation

      Post

           I'm trying to develop an application in FM13 after being away from FM for awhile and writing in a "conventional" language.  So here's something I have to do that was easy in C.  I need to calculate the cost of building a fence (ranch kind, not backyard) and it can have 2 different types of wire (say barbed wire plus a couple of strands of electric wire).  It can/will have corner posts, standard posts and then extra support posts (I call them Interval Posts).  The standard and interval posts each have a spacing factor.  Say the "T-posts" are spaced every 8 feet but there is a heavier support post every 50 feet.  I have to calculate the number of standard post needed by dividing the total perimeter footage by the spacing factor but the subtract the number of interval posts that are calculated in the same fashion.  Plus other factors but this will get to my point.

           Before I can calculate the number of standard posts needed I have to calculate the number of interval posts.  If these calculations are in the database as calculation fields how do I know the sequence they will be performed?

           Would it make more sense to have the user input all the relative data and then click a "calculate" button that performs a script and then plugs the calculated values into the DB record?  This would allow me, with the use of local variables, to break the steps down to where everything is fairly simple and is the way I think I want to do it.  But I sure would like to hear from some FM experts before I commit one way or the other.

           thanks, bill

            

      FenceCalculator.jpg

        • 1. Re: Use Script or Calculation fields in Database - complicated computation
          philmodjunk

               I'm not sure that you need to worry about the order in which they are performed.

               It should be possible to: A) compute the total posts, then B) compute the number of posts of each type. The T-Posts would be the number of posts of all kinds minus the total number of Support posts.

               But there are some interesting details that can tweak the total number of posts of each type--including whether the fence forms a closed figure (such as a corral) or does not (Say you are replacing the current fencing on one side of a large pasture...) And whether you need to add pots spaced different than the ideal due to the presence of corners where the fencing changes direction...