rivet Posted September 14, 2005 Posted September 14, 2005 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.
Ender Posted September 14, 2005 Posted September 14, 2005 What is holding the array? Is it all in a single text field? A repeating field? A related field?
rivet Posted September 14, 2005 Author Posted September 14, 2005 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 & "Ω" ; "") )
Ender Posted September 14, 2005 Posted September 14, 2005 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) )
Ender Posted September 14, 2005 Posted September 14, 2005 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)
Recommended Posts
This topic is 7008 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now