What do you get if you take away the Round() ?
Set Variable [$valueBeforeRounding; Contracts::Agreed charges 07 MSC percentage / Get ( FoundCount )]
Many thanks for your quick reply, if I change the script as suggested I still get 0.00
The actual script line is:
Set Variable [$perc; Value: Round ( Contracts::Agreed charges 07 MSC percentage / Get ( FoundCount ) ; 2 )
This might be more helpful than posting only a bit of it earlier.
You might be on a layout based upon a table that is not connected to Contracts, because apparently
Contracts::Agreed charges 07 MSC percentage
evaluates to 0
Their is nothing that i could do to produce the result 0.00 with the calculation as stated.
it only returns 0
There is definitely a relationship between the 2 tables, I've just double checked, let me give a bit of an overview:
The 2 tables are Contracts and Repayment schedule for contract CD, there is a relationship between the 2 based on Contract ID. The field that I am trying to calculate 'Schedule 02 Percentage' is from the Repayment schedule for contract CD table and on this particular layout (based on contracts) in a portal.
Originally (I never created the script) was as follows:
Set Variable [$perc; Value: Round ( 1 / Get ( FoundCount ) ; 2 )
However, this was not calculating what it should be, as it should take the % entered in to Contracts::Agreed charges 07 MSC percentage and divide it by the number of entries that are specified so that we can calculate the amount due.
e.g. in Contracts::Agreed charges 07 MSC percentage there is 12% there is a another field called total fees, what happens is we click on enter repayment schedule, it askes how many repayments, we enter 6, it should add 6 repayments, the 12% should be divided giving 2% in each of the Schedule 02 percentage fields in the portal. Then the schedule 03 amount due calculates the percentage of total fees as set in Schedule 02 percentage entering the amount that is due.
But at present all I am getting is a zero. Would I need to create a new relationship for this to work?
It shows a result of 0.00 as I have the decimal places fixed at 2, if I remove that then it would just display 0 as you have.
This is in fact correct, I never actually checked which table it should refer to, and this was where the problem lied, it should have been 'Contract for repayment schedule::Agreed charges 07 MSC percentage' so once I set this it worked perfectly, thanks for all your help.
I am not very clear on the context in which the script step runs. It seems that it is the CONTRACT table.
If it is the case and your context is the CONTRACT table, the Get ( FoundCount ) will give the number of Contracts found in the current set, but your formula, as I understand it, needs to have the count of REPAYMENT records. My theory is the found set when in the CONTRACT context is large enough so that the result is less than 0.005, This will always be rounded to zero in your formula.
The test Siplus suggested will give you a good insight on the problem at hand but you need to change the number formating to General (in Inspector > Data > Data Formating) before doing the test. Right now, you are rounding anyway because of the formating you are using.
If this is indeed the problem, we will need to look at how the script is constructed in order to troubleshoot it.