filemaker implode array
So lets say my calculation is this
Let (
[
$result[1]开发者_JS百科 ="1";
$result[2] ="!";
$result[3] = "3";
$result[4] = "4";
$result[5] = "5";
$result[6] = "6";
$result[7] = "7";
$result[8] = "8";
$result[9] = "-";
$result[10] = "10";
$result[11] = "11";
$result[12] = "12";
$result[13] = "13";
$result[14] = "14";
$result[15] = "15";
$result[16] = "!";
];
$result[1] &
$result[2] &
$result[3] &
$result[4] &
$result[5] &
$result[6] &
$result[7] &
$result[8] &
$result[9] &
$result[10] &
$result[11] &
$result[12] &
$result[13] &
$result[14] &
$result[15] &
$result[16]
)
this is pretty straight forward I make and array and then I want to it to return the array as a string is there and easier way to concatenate the the values of the result array ?
** Sample custom functions *** trying to use @chuck 's code not sure what I'm doing wrong I could figure out how to upload a file so here are some mimages
Here's two custom functions that should work if you can assume that once you get to a blank value in the array, you've reached the end of the array. I wrote it very quickly and only tested it once, but perhaps it'll do the job for you.
ConcatArray( VarName ) = _ConcatArray( VarName; 1 )
This just calls a recursive function with an initial value.
_ConcatArray( VarName; Iteration ) = Let(
[
Var = Evaluate( "$" & VarName & "[" & Iteration & "]" )
];
Case(
IsEmpty( Var );
"";
Var & _ConcatArray( VarName; Iteration + 1 )
)
)
I then opened the Data Viewer in FileMaker and tested it with this calculation.
Let (
[
$result[1] ="1";
$result[2] ="!";
$result[3] = "3";
$result[4] = "4";
$result[5] = "5";
$result[6] = "6";
$result[7] = "7";
$result[8] = "8";
$result[9] = "-";
$result[10] = "10";
$result[11] = "11";
$result[12] = "12";
$result[13] = "13";
$result[14] = "14";
$result[15] = "15";
$result[16] = "!"
];
ConcatArray( "result" )
)
The result was 1!345678-101112131415!
.
You could do it with a recursive custom function. Specify the end range and the var name as parameters and it could then repeatedly call itself with an incrementing index number until that index number equaled the end range.
精彩评论