Script not calculating correctly?

I have a slight problem with a part of a script, the part I'm having problems with is as follows:

Round ( Contracts::Agreed charges 07 MSC percentage / Get ( FoundCount ) ; 2 ) for some reason, even though the field that it refers to is populated with a number it returns 0.00, I've checked the field and it is set up as a number, the format for the number is decimal with fixed decimal place of 2 and the amount entered is 0.1 showing as 10%. At first I thought it was because it was 0.1 and the round function was causing it to zero, however I have put 100 in there and still get zero, doesn't matter what number I put in the Contracts::Agreed charges 07 MSC percentage field, I always get 0.00 as the result. However, if I change the script to Round ( 100 / Get ( FoundCount ) ; 2 ) I get the correct result, so it is obviously a problem with it looking at that field.

Anyone have any ideas why this would be doing this? And how I can fix it?

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?

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.