Das Notes Forum
Domino 9 und frühere Versionen => Entwicklung => Thema gestartet von: Till_21 am 15.11.02 - 15:53:39
-
hi zusammen,
wie, *** *** ***, schaffe ich das minimum einer nummernliste rauszubekommen. es handelt sich um ein Default-Value. Desweiteren sind keine lookups erlaubt.
dankt euch,
till
ps: die @min-fnkt ist jawohl eine frechheit
-
Ja, muß man unbestritten zugeben. Auch daß in den Totals keine Min/Max-Funktionen unterstützt werden, hat mich schon bitter gefuchst.
Ev. hilft das?
Quelle Notes411 (glaube ich):
If your numeric list is an item called NumberList, the following formula will return its largest element:
tmpOnes:=@TextToNumber(@Explode(@Repeat("-1,";@Elements(NumberL ist))));
tmpA:=tmpOnes**NumberList;
tmpB:=NumberList**tmpOnes;
@TextToNumber(@Unique(@Trim(@Replace(@Text(NumberList);@Text(( @TextToNumber(@Unique(@Trim(@Replace(@Text(tmpA-@Max(tmpA;t mpB));"0";""))))*+NumberList));""))));
How does it work? OK. Here goes:
Suppose the list is 1, 3, 5.
We create two new lists (tmpA and tmpB) as follows:
tmpA tmpB
-1 -1
-3 -1
-5 -1
-1 -3
-3 -3
-5 -3
-1 -5
-3 -5
-5 -5
@Max these two lists to get a new list where each element is the greater of the two elements in tmpA, tmpB:
-1
-1
-1
-1
-3
-3
-1
-3
-5
Note that -5 (the smallest value) only occurs once. It can only be the greatest value when compared with itself. So, pairwise-subtract this list from tmpA:
0
-2
-4
0
0
-2
0
0
0
Convert to text, replace all the "0" with "", trim, make unique, and convert back to numbers. You are left with just -2 and -4.
Now, permute-add NumberList to this:
-1
-3
1
-1
-3
1
The last couple of steps have basically removed the greatest element.
Finally, convert this to text, replace the elements of number list that coincide with this list with a null. Trim, make unique, convert to a number and you are left with the greatest number in NumberList.
-
das nenn ich nen workaround :)
feine sache, dank dir, werds mal probieren.
gruss / till
-
na da hat aber jemand echt die Gehirnmuckis spielen lassen..Baff bin..
(http://www.gif-para.de/Bigbody_31_1kb.gif)
-
Hier nochmal die Quelle, war nicht 411:
Return the greatest element in a number list
Type: Formula
Submitted By: Roberto Casula
For: Notes or Web version 4.x
Return the greatest element in a number list
http://freedomino.danieljweb.net/c0033.html (http://freedomino.danieljweb.net/c0033.html)
-
Eine andere Lösung wäre natürlich, einfach R6 zu verwenden ... ;D
Aber da wir hier im R5 Entwicklungsforum sind, sollte ich mir das breite Grinsen wohl lieber verkneifen, und lieber ehrfürchtig auf das Formelungeheuer starren (ich liebe solche Listen-Hacks, ganz im Ernst). ;)
-
Das sind solche Informatik(er)-Lösungen.... nein, meine ich ganz im Ernst.
-
... Hut ab...
... manchmal ist es besser hinzunehmen das etwas funktioniert, ohne zu wissen warum...
ata