Choose, Lookup, and finding offset values

4.20K viewsFormulas and Functions
0

I’m wanting to find the n’th value in a list (specifically a vector in a matrix).
The obvious function would appear to be Choose – but this seems to require an explicit comma delimited list following the offset i.e. per the Sample:
[code:3c1nm1n6]result = choose(3,Lists::B1,Lists::B2,Lists::B3,Lists::B4,Lists::B5,Lists::B6,Lists::B7,Lists::B8,Lists::B9,Lists::B10)[/code:3c1nm1n6]
whereas this (which is what I need, since I don’t know in advance how many items may be in the category) fails:
[code:3c1nm1n6]bad = choose(3,Lists::B)[/code:3c1nm1n6]

On the other hand with Lookup I can have
[code:3c1nm1n6]result = lookup(3,Key List::B,Lists::B) [/code:3c1nm1n6]
(I don’t need to state the range explicitly as in the sample:
[code:3c1nm1n6]result = lookup(<foo>,Lists::B1 .. B10,Key List::B1 .. B10) [/code:3c1nm1n6])

But that requires me to create a dummy Key List with 1 – n as values for Items named 1 – n. Plus reversing the order of the Key List and the values List.

All of which seems very strange. What am I missing – and why doesn’t Choose do what I would expect?

Thanks

0

Agreed – we need to do a better job on application help. We do have a modeler note on this subject:

[url:12s6cj8h]http://www.quantrix.com/Leveraging_Operators.htm[/url:12s6cj8h]

You are viewing 1 out of 3 answers, click here to view all answers.

Latest Questions