hcl-bot
January 31, 2007, 12:57pm
1
Hello!
Lotus 6
@Formula
I have some trobles whit my this formula!
I want to sum the values from list field artsave2 to list field wert1!
And I have made the following formula!
Field artsave2 has following values:
1,49~2;
1,99~4;
1,99~6;
2,99~8;
2,99~9;
Field wert1 has this values:
1,29~0;
1,49~0;
1,39~0;
1,59~0;
1,80~0;
1,99~0;
2,19~0;
2,50~0;
2,75~0;
2,79~0;
2,81~0;
2,99~0;
3,29~0;
3,49~0
@For (n := 1;
n <= @Elements (artsave2);
n := n + 1;
imp1:= @Subset (@Subset (artsave2; n); -1);
imp2:= @Word (imp1;“~”;2);
Memb := @Member (@Word (imp1;“~”;1);@Word (wert1;“~”;1));
Preis :=@Word(@Subset (@Subset (wert1; Memb); -1);“~”;1);
Zahl1 := @Word (@Subset (@Subset (wert1; Memb); -1);“~”;2);
ZahlNeu := @TextToNumber (Zahl1) + @TextToNumber (imp2);
WertNeu:= @Text (Preis) +“~” + @Text (ZahlNeu);
Subset1:=@Subset(wert1;memb -1);
elements := @Elements (wert1) - memb;
Subset2:= @Subset (wert1; - elements);
wert2 := subset1 : subset2 : WertNeu;
@Sort (@Word (wert2;“~”;1));
FIELD wert1 := Wert2
)
But it doesn´t work!
I want to have the following result
1,29~0;
1,49~0;
1,39~0;
1,59~0;
1,80~0;
1,99~10;
2,19~0;
2,50~0;
2,75~0;
2,79~0;
2,81~0;
2,99~17;
3,29~0;
3,49~0
What can I do!
Thank you for helping!
mfg
Jörg
Subject: Problem whit Lists?
I created a form.
One field is named ‘artsave2’ and has this default value: “1,49~2” : “1,99~4” : “1,99~6” : “2,99~8” : “2,99~9”
Another field is named ‘wert1’ and has these default values: “1,29~0”:“1,49~0”:“1,39~0”:“1,59~0”:“1,80~0”:“1,99~0”:“2,19~0”:“2,50~0”:“2,75~0”:“2,79~0”:“2,81~0”:“2,99~0”:“3,29~0”:“3,49~0”
Note that both field has semi-colon only specified as separator, definitely not comma.
I then created a 3rd field and named it ‘SumUpped’, also multi-value and using semi-colon only as separator.
A button in the form has this code:
newSum := “”;
@For (ix := 1; ix <= @Elements (wert1); ix := ix + 1;
leftPartIx := @Left(wert1[ix]; "~");
rightPartIx := @Right(wert1[ix]; "~");
curSum := @TextToNumber(rightPartIx);
@For (jx := 1; jx <= @Elements(artsave2); jx := jx + 1;
leftPartJx := @Left(artsave2[jx]; "~");
rightPartJx := @Right(artsave2[Jx]; "~");
@If (leftPartJx = leftPartIx; curSum := curSum + @TextToNumber(rightPartJx); "")
);
newEntry := leftPartIx + "~" + @Text(curSum);
newSum := newSum : newEntry
);
@SetField (“SumUpped”; @Trim (newSum))
It seems to work fine.
Subject: RE: Problem whit Lists?
Hello!
Thank you for your help, thats realy great
but I cannot use unfortunately List , since application is to run also on a PocketPC!
Is there a way to make this wiht out the list syntax?
Thank your for helping!
Jörg
Subject: RE: Problem whit Lists?
Hello!
I change your formula to this and it works fine!
Thank you very mutch!!
newSum := “”;
@For (ix := 1; ix <= @Elements (wert1); ix := ix + 1;
leftPartIx :=@Word(@Subset (@Subset (wert1; ix); -1);“~”;1);
rightPartIx := @Word (@Subset (@Subset (wert1; ix); -1);“~”;2);
curSum := @TextToNumber (rightPartIx);
@For (jx := 1; jx <= @Elements (artsave2); jx := jx + 1;
leftPartJx :=@Word(@Subset (@Subset (artsave2; jx); -1);“~”;1);
rightPartJx := @Word (@Subset (@Subset (artsave2; jx); -1);“~”;2);
@If (leftPartJx = leftPartIx; curSum := curSum + @TextToNumber (rightPartJx); “”)
);
newEntry := leftPartIx + “~” + @Text (curSum);
newSum := newSum : newEntry
);
@SetField (“SumUpped”; @Trim (newSum))
sy
jörg
Subject: RE: Problem whit Lists?
Nice work Ken! I was just gonna try and tackle this but you beat me to it.