alexpreyer
17th September 2010, 12:51
I have a multi occurrence session where per record are 5 fields with values (percentages). To help the user to fill not more then 100% in sum in all fields I need to calculate the sum for each record separatly. At the moment I managed it only to get the same sum for each line/record. Does anyone has a hint how to get the sum for each line separate?
rberti
17th September 2010, 22:42
Hi Alex.
I did it once using arrays. It would be indexed by account and cost center. this way, when user fill the fields wth the percentages, you sum the values saving it in the array dimension of the current line (account & cost center).
BaanInOhio
18th September 2010, 07:34
Since its a type 3 form, you have to use a function referenced by one of the 'occ' functions. To get the fields for the current occurrence, use "do.occ.without.update" with the occurrence number (first argument) set to 'actual.occ' (predefined variable for the current occurrence). The function can sum the percentages and set the display field for the total.
MilindV
18th September 2010, 08:42
Hi,
If it is possible to change table defn, include total field in table itself.
Which ll help u. N code ll become simpler...
just on when.field.change event assign sum of all fields to total fields. that's it!!
Regards,
MilindV
alexpreyer
20th September 2010, 12:13
Hi,
If it is possible to change table defn, include total field in table itself.
Which ll help u. N code ll become simpler...
just on when.field.change event assign sum of all fields to total fields. that's it!!
Regards,
MilindV
Due that the session is in development, I think I'll do as suggested above. Thanks for the fast and great help.