List Help!

I have a list of 8 numbers…

Lets say 120:117:119:120.1:119:123

I would like to produce an alternate list whic is a ‘place’ order of the number list. Such as:

Place ==> 4:1:2:5:2:6

Which basically give the ‘order’ with 119 producing a ‘tie’ for 2nd place…

(notice 2 is repleated and 3 is skipped)

Any suggestions on how to do this? I am using Notes 6…

Thanks

Subject: Well, you can do this fairly simply.

Assuming your Number List is in field NList, created a Computed field w/ the following formulaN1 := “0” : “1” : “2” : “3” : “4” : “5” : “6” : “7” : “8” : “9”;

N2 := @Subset(N1 *+ N2; -99);

SList := @Sort(NList);

@Replace(NList, SList; N2)

Subject: RE: Well, you can do this fairly simply.

Thanks!

Can you explain: N2 := @Subset(N1 *+ N2; -99);

??

Subject: Sure…

The “*+” operator adds each element of the second list to every member of the first list in order so you would get:N1 *+ N1 would equal “00” : “01” : “02” … : “99”;

The @Subset( ; -99) strips off the “00” from the begining of the list.

Subject: One last quickie…

Ok, if I, now that I have the list of ‘places’… 120, 117, 119, 121, 119, 123 list to:

4, 1, 2, 5, 2, 6

Based on another list of: 0, 0, 0, 0, 1, 0

The ‘1’ flags that the second 119 should be ‘2’ and the first 119 ahould be ‘3’…

ie: the places list is modified from:

4, 1, 2, 5, 2, 6 to 4, 1, 3, 5, 2, 6

and if the list was: 0, 0, 1, 0, 0, 0

ie: the places list is modified from:

4, 1, 2, 5, 2, 6 to 4, 1, 2, 5, 3, 6

Understand? Can you think of an easy way to to that?

Thanks!

Subject: Yeah, you just have to make them unique…

If they are all Integers. You also have to know the Max value. Assuming a maximum of 1000, N1 := “0” : “1” : “2” : “3” : “4” : “5” : “6” : “7” : “8” : “9”;

N2 := @Subset(@Subset(N1 *+ N2; -99); @Elements(NList));

N3 := @Right(“000” + @Text(NList); 4) + “~” + N2);

SList := @Sort(N3);

@Replace(N3, SList; N2)

Subject: No… you miss understood…

Bill,

Here is what I mean…

If I have a list 120,117,119,121,119,123

And I get their places (as you helped)

4, 1, 2, 5, 2, 6

Now - I have another list in situation ‘A’

of 0, 0, 0, 0, 0, 0

This means - I do nothing to the ‘places’ of:

4, 1, 2, 5, 2, 6

Now - Situation ‘B’

of 0, 0, 1, 0, 0, 0

This means - I have ‘decided’ that the first person withe the 119 time should be 2 and the second should be 3… therefore changing the places to: 4, 1, 2, 5, 3, 6 (note 2nd ‘2’ is changed to ‘3’(or next higher number)

Now - Situation ‘B’ couold be

of 0, 0, 0, 0, 1, 0 which changes places to:

4, 1, 2, 5, 3, 6 (note 1st ‘2’ is changed to ‘3’ (or next higher number)

Assume I already have the places values calculated and need to do the ‘correction’ based on the Situation list… Also assume that ONLY the ones ‘marked’ with a ‘1’ would be either of the duplicates… (ie: 3rd or 5th - not the others) ((basically the users flag which should be the primary one…

Understand?

Subject: Ok then this is much more simple.

FIELD Order1 is.N1 := “0” : “1” : “2” : “3” : “4” : “5” : “6” : “7” : “8” : “9”;

N2 := @Subset(N1 *+ N2; -99);

SList := @Sort(NList);

@Replace(NList, SList; N2);

Now you have Field Adjust1 = 0 : 0 : 1 : 0 : 0 : 0

N1 := @TextToNumber(Order1);

N1 + Adjust1

Subject: Answer

First Thanks for you help…

You missed a minor point to the problem…

If I have a list 120,117,119,121,119,123

And I get their places (as you helped)

4, 1, 2, 5, 2, 6

Now - I have another list in situation ‘A’

of 0, 0, 0, 0, 0, 0

This means - I do nothing to the ‘places’ of:

4, 1, 2, 5, 2, 6

Now - Situation ‘B’ marks the one NOT to change!

0, 0, 1, 0, 0, 0

This means - I have ‘decided’ that the first person with the 119 time should be 2 and the second 119 time should be 3… therefore changing the places to: 4, 1, 2, 5, 3, 6 (note the one NOT marked is changed!


I did solve this as follows:

A= 0,0,1,0,0,0 (which one is marked NOT to be changed)

B= 0,0,1,0,1,0 (identifies which two are tied)

Abs(A-B) == 0,0,0,0,1,0 - then I add it to the 4, 1, 2, 5, 2, 6 == 4,1,2,5,3,6


Thanks for your help!!!