Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 7008 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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.

Posted

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 & "Ω" ; "")

)

Posted

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)

)

Posted

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)

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.