September 14, 200520 yr I am looking for a clean calc to get a string from an array, build from a value list. I have a id then a delimiter then the string. 001Ωthis is string one 002Ωthis is string two 003Ωthis is string three I would like a custom calc to get the string based on the choosen number.
September 14, 200520 yr What is holding the array? Is it all in a single text field? A repeating field? A related field?
September 14, 200520 yr Author the list comes from a value list. Here is where I am at, I feel it could be cleaner: custom calc: qTip (valueList ; num) Let ( [ vlist = ValueListItems ( Get ( FileName ) ; valueList )] ; Substitute ( GetValue(vlist ; PatternCount ( Left (vlist ; Position ( vlist ; num ; 1 ; 1 ) ) ; "¶" ) + 1 ) ; num & "Ω" ; "") )
September 14, 200520 yr If you just needed it to return the string on the nth line, you could use the MiddleValues() function: MiddleValues ( text ; n ; 1 ) If you need it to use your index, then you could make a custom function to search the text field, or just use a calc like this: Let( [ index = GetAsText( Right( "000" & n; 3 )); indexPos = Position( ¶ & text; ¶ & index & "Ω"; 0; 1 ); start = Case(indexPos; indexPos + 4); end = Case(indexPos;Position( text & ¶; ¶; start; 1 )) ]; Middle ( text ; start; end-start) )
September 14, 200520 yr BTW, If you're building this into a custom function, I'd recommend sending the return delimited text result of your value list items instead of sending the name of the value list. This should help make the CF more portable. The function call would then look more like this: qTip ( ValueListItems ( Get ( FileName ) ; "My Value List" ) ; num)
Create an account or sign in to comment