October 29, 200718 yr Hi All I am trying to write a script that calculates the thickness and width of an reinforcement pad. I have asign one variables with the starting width and another varible with the starting thickness but would like to change the varible entity if they need to be wider and thicker. This is what I have done so far but it does not quite work. Set Variable [$dp; Value: Field a + Filed b] Set Varaible [$te; Value: .375 If[if(area_required > total_area; A5=($dp*$te);"")] endif loop If[case(area required > total_area; $dp=($dp + .5) and $te=($te+.125); A5 = ($dp*$te)] endif If[area_required < total_area] EXIT Script [] endif endloop The looping script is where I have the problem. The variables do not change. Is ther a way of having the varible increase until the total area becomes larger than the area required? I hope I have explain my problem to understand what I am trying to do. Thanks Lionel Edited October 29, 200718 yr by Guest
October 29, 200718 yr Can you explain the actual problem (in non-Filemaker terms)? I gather you start with a given width and thickness, and a required area. The rest is a complete mystery.
October 29, 200718 yr Author Comment Sorry about that. I want to increase the width and thickness of the reinforcement pad until the total area is greater that the area required. Example Thickness is set at .375 width at 2 I want the width varaible to increase by .5 segments and the thickness variable to increase by .125 segments until the total area is greater then the area required. Hope this explaination helps. Lionel
October 29, 200718 yr I'm afraid it's still not very clear. Is the area calculated as width * thickness? And what determines which variable should be increased, and by how much? You can get a variety of results here, all seemingly correct. My instinct would be to increase both parameters by the same ratio to get the required area, then round them up to the next 'notch'. This could be done by a relatively simple calculation - no looping required. But perhaps you need something else?
October 30, 200718 yr Author comment You are correct, both variables will be change at the same time. The calculation is width * thickness. the required area will be calculated and will change as the condition change. the thickness variable will be set at 2 inches. The thickness varaible will be set at .375 inches If the [color:red]required area is larger than the [color:red]total area then I want the width area to be increase by 1/2 inch and the thickness area by 1/8 inch until the required area is less than the total area and then the script will exit. Thanks Lionel Edited October 30, 200718 yr by Guest
October 30, 200718 yr Do I understand this correctly: You ALWAYS start with an area of 2 * 0.375 = 0.75 sq.inch. You want to increment BOTH values x times, with each increment adding 0.5 to the width and 0.125 to the thickness, until the required area is reached or exceeded?
October 30, 200718 yr Well, if you want to do this with a script, I think you could do something like: Set Variable [ $a ; 2 ] Set Variable [ $b ; 0.375 ] Loop Exit Loop If [ $a * $b ≥ RequiredArea ] Set Variable [ $a ; $a + 0.5 ] Set Variable [ $b ; $b + 0.125 ] End Loop # NOW DO SOMETHING WITH THE VARIABLES However this seems a bit pedestrian, since x could be computed directly from the formula: ( 0.5*x + 2 ) * ( 0.125*x + 0.375 ) = A where A is the required area. If I'm not mistaken*, this can be rewritten as: x^2 + 7*x + 12 - 16*A = 0 and solved as a quadratic equation. Edited October 30, 200718 yr by Guest (*) and of course I was...
Create an account or sign in to comment