Domino 9 und frühere Versionen > Entwicklung

@min mit nummernliste

(1/2) > >>

Till_21:
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

wflamme:
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.


Till_21:
das nenn ich nen workaround :)

feine sache, dank dir, werds mal probieren.

gruss / till

Rob Green:
na da hat aber jemand echt die Gehirnmuckis spielen lassen..Baff bin..

wflamme:
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

Navigation

[0] Themen-Index

[#] Nächste Seite

Zur normalen Ansicht wechseln