Hi all i have declared a global vriable with 2 repetition,
set variable [$$arr[2];value:"9557878322"]
as i know i have declared it with 2 开发者_C百科repetition so that it should store maximum two value but i dont know how to insert multiple value when we declare global variable with more then 1 repetition.
what i want : declare global variable with repetition 2 it will look like $$arr[2] i want to insert two values so that arr1 refer first value and arr[2] refer 2nd value......
Here i have entered a snap where u can see thet i have declared repetition 2..
Thanks in advance.
You need to either use the Set Variable step twice or set the values within a Let statement:
Let( [
$arr[1] = "Value 1";
$arr[2] = "Value 2" ];
"" )
You can use either a dummy statement as above or make it a part of a some other step.
If you're happy using valuelists, then you don't need a 2 repetition variable. Instead once you've set your $arr as you've shown in the screen shot, just use
MiddleValues ( $$arr ; index ; 1 )
to retrieve the the value at [index] (remembering that it will have a return attached), and
$$arr = $newValue & ¶ & RightValues ( $$arr ; 1 )
to set the first value, or
$$arr = LeftValues ( $$arr ; 1 ) & ¶ & $newValue
to set the second value.
HOWEVER, I suspect you might be better off altogether taking a look at Passing Named Parameters and Dictionary Functions which outline some useful tricks for storing values in dictionaries - there are a whole slew of custom functions that you'll probably find useful for working with associative arrays in FileMaker.
You're assignment in your dialog box might look something like:
Name: $arr Value: #("1" , 9557878322 ) & #("2" , 8430695900 )
and the values could be retrieved as
#?($arr , "1")
or
#?($arr , "2")
or reset using
#c($arr, "1" , 1234 )
The syntax of these new custom functions ( # , #? and #c ) takes a bit to get used to, but it may be the sort of things that you could use for this task, but which would also broaden how you use calcs in FileMaker in the future too. Or not ;-)
精彩评论