I don't understand what you mean by this:
If the numbers that yeild this number are larger the dollare amount will be 4 figures...
EX. 13256989756326 would turn into $ 1325.69.
In this example my calculation is (58.78 * 1700) * 60.00.
Greater than what dollar figure?
Why wouldn't the figure be: 1325.70 (rounded to nearest penny)?
58.78 * 1700 * 60.00 = 5995560.00
so I don't understand where/how you get 13256989756326
Are you saying that since 13256989756326 is greater than 5995560, you only want the left 7 digits (how is that 4 figures?) of 13256989756326 ???
This is the issue:
This is my calculation: ( 100 - GetValue ( $discount_pct ; $counter ) ) * $toplinenumber / 100
$discount_pct = 17.5
$toplinenumber = 1296
By my calculator i should get...
100- 17.5 = 82.5
82.5*1296 = 106920
106920/100 = 1069.20 whis is the number i need.
What is there about filemaker that makes the number: 1069306930693069306930693069306930693069306930693069306930693069306930693069306 and is there a way to get the correct number?
It can't be by just taking the numbers to the left.... its a long story...
If $discount_pct is 17.5
using GetValue makes no sense. What values are really in $discount_pct and $counter?
When I use That expression, it evaluates correctly, so I think the data in one or both of these variables is not what it should be. See the screen shot.
I use the getvalue because its part of a loop. I used the loop to determine the number of vendors and what discount they offer. There could be 1 or 5... It pulls it from a sequence... 17.5, 40.3, 60.5, 50.53
When i use the viewer they are accurate up to the point it does my calculation above.
This is the loop:
- Exit Loop If [ Let ( [ $counter = $counter + 1 ] ; $counter > ValueCount ( $carrier ) ) ]
- Set Field [ Rates Dispaly::RDCarrier; GetValue ( $carrier ; $counter ) ]
- // Set Field [ Rates Dispaly::RDRate; Let ( [ ~min = GetValue ( $discount_min ; $counter ) ; ~pct = GetValue ( $discount_pct ; $counter ) ] ; ~pct * $toplinenumber ) ]
- Set Field [ Rates Dispaly::RDRate; ( 100 - GetValue ( $discount_pct ; $counter ) ) * $toplinenumber / 100 //GetValue ( $discount_pct ; $counter ) * $toplinenumber ]
- #provides amount to reduce toplinenumber by. When reduce it by that much i get rate before fuel.
- Set Field [ Rates Dispaly::RDTransit Days; GetValue ( $discount_pct ; $counter) //GetValue (100-$discount_pct ; $counter ) ]
- Go to Portal Row [ Select; Next; Exit after last ]
- End Loop
GetValue requires that the values be separated by returns, not commas. Are they?
My example uses the List function to create such a return separated list so that it can demonstrate that the expression computes the correct value.
I think you have a comma delimitted list instead of return delimitted and thus get value is returning all the values as a single number.
I used the loop to determine the number of vendors and what discount they offer.
I've mentioned lookup tables in another thread you had. I think you need to investigate that option. Such a looping script need not be necessary
This is my script for seperating them:
Case ( not IsEmpty ( $discount_pct ) ; $discount_pct & "¶" ) &
I checked the viewer... the values are seperateed by a space... 17.5 40.3 60.5 50.53
Depending on how you are using the viewer, returns may show as spaces in the dataviewer. If you use the "watch" tool in the viewer and click the evaluate button, you'll get a list, but if you are just stepping through a script and the variable pops up in the viewer, the returns will show as spaces to keep the data all on one line.
I think you are using:
Case ( not IsEmpty ( $discount_pct ) ; $discount_pct & "¶" ) & DiscountValueToBeAddedHere
In a script to build your list of discount pct values. If so, this calculation should work as this would produce the same return separated list of values as is produced in my example with the list function.
If I am understanding your posts, you can actually simplify your expression to be:
Set Variable [$discount_pct ; value: list ( $discount_pct ; DiscountValueToBeAddedHere ) ]
Which doesn't explain what's going wrong with your calculation, however. I suggest putting
<<Discount_pct>> inside a block of text sized to be many values in height on your layout or putting it in a show custom dialog step in order to monitor the values in this variable at the time your script executes to see if there are any unexpected issues here.