forked from DonovanChan/fmfunctions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathArrayValueNext.calc
37 lines (30 loc) · 1.01 KB
/
ArrayValueNext.calc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Let([
_row = ArrayRow ( array; rowHeader; headerColumn );
_rowNum = ListValueRowNum( Substitute( _row; Tab; ¶ ); searchValue );
_rowNumNext = If( _rowNum > 0; _rowNum + 1; "" )
];
Case(
//-- Column is valid
_rowNum > 0;
RowValue( _row; _rowNumNext );
//-- Column not found
""
)
)
/*---------------------------------------------------------------------------------------
NAME:
ArrayValueNext ( array ; rowHeader ; headerColumn ; searchValue )
PURPOSE:
Finds row in array (tab-delimited) that corresponds to rowHeader in headerColumn.
Then returns value from column following searchValue.
HISTORY:
Created 2010-Mar-22 12h44 [email protected]
EXAMPLE:
If $_array =
"A » pear » apple¶
B » ball » bat¶
C » dog » cat¶
B » can » bottle¶"
where " » " represents tab character, then :
ArrayValueNext ( $_array ; "B" ; 1 ; "ball" ) returns "bat".
---------------------------------------------------------------------------------------*/