I have multivalue fields, they are filled in by a subform, in the subform the fields are checked to know if they contain a number. I do this with a javascript. function isNumber(field) {
var f = window.document.forms[0];
var s;
s=f[field].value;
if(s!="") {
if(isNaN(s)) {
f[field].value=0;
alert("Only numbers may be entered");
}
}
}
Now the problem is, the isNaN function allows a point in it but no comma.
When I use @sum the numbers after the point are not counted. This is my sum function:
sum := @If(drdfReceptions=“”;“0”;@Sum(@TextToNumber(@Explode(drdfReceptions))));
sum;
Is their a way to replace the point by a comma in the javascript? I tried this but that doesn’t work.
function isNumber(field) {
var f = window.document.forms[0];
var s;
s=f[field].value;
if(s!="") {
if(isNaN(s)) {
f[field].value=0;
alert("Only numbers may be entered");
}
for (i = 0; i < s.length; i++) {
mychar = s.charAt(i);
if(myChar == ".") {
myChar = ",";
f[field]=s;
}
}
}
}
Or is their to change the field in lotus to add up numbers with points instead of commas? Or any other solution?
Help is welcome 
regards
EDIT
What I did was write a function to replace the point by a comma. The problem is in the subform I also have to make a total, there I calculate the total via javascript (on every field it fires the onChange event and starts that script) Unfortunately this script needs a point again instead of a comma.
So, is there no possibility in lotus to use the @sum with values such as “1.20” or “7.67”?
Subject: @sum problem EDIT problem solved
Use the replace function in JS (uses regular expressions).
function isNumber(field) {
var f = window.document.forms[0];
var s;
var r;
r=f[field].value;
s=r.replace(.,g,“,”)
if(s!=“”) {
if(isNaN(s)) {
f[field].value=0;
alert(“Only numbers may be entered”);
}
for (i = 0; i < s.length; i++) {
mychar = s.charAt(i);
if(myChar == “.”) {
myChar = “,”;
f[field]=s;
}
}
}
}
Subject: I think I know a way to fix it, but don’t know if it’s possible
I have for example 3 multivalue fields.In the first and second are numbers, the third one has to be the first + the second column.
Something like this:
Field1: Field2: Field3:
1 5 6
17 31 48
75 12 87
…
I tried to accomplish this with the following formula:
sumTotalRow := @For(i=0;i<100;i:=i+1;
value1[i] := @If(drdfReceptions[i]=“”;0;@TextToNumber(drdfReceptions[i]));
value2[i] := @If(tdrdfHotels[i]=“”;0;@TextToNumber(drdfHotels[i]));
@Text(@Sum(value1[i]:value2[i])));
sumTotalRow
But that doesn’t work. Is it possible to get a certain value out of a multivalue field by using an array like [5] for the getting the 5th element in the multivalue field.
Subject: RE: I think I know a way to fix it, but don’t know if it’s possible
Is this what you are trying to do? Make your SumTotalRow a computed field with the following formula:
NbrElements:=@Elements(drdfReceptions);
srcList:=“”;
@For(
n := 1;
n <= NbrElements;
n := n + 1;
srcList:=srcList:@Text(@Sum(@TextToNumber(drdfReceptions[n]):@TextToNumber(tdrdfHotels[n])))
);
@if(@IsDocBeingSaved;@Trim(@Text(srcList));“”)
The only thing with this approach is you need to make sure both fields 1 and 2 have matching entries. Things would get thrown off if field1 had three values and field2 had 5.
The @For that you had originally posted has an error in the syntax. You needed the first line to be i:=0 instead of i=0…
Hope this helps,
wmoze
http://www.wmoze.com