June 7, 201015 yr I am very familiar with how to utilize arrays in programming.. but for some reason in FMP I am a little lost on how set this up. I just need a very basic static array. I know it will have 12 values at max. I have a loop.. --------------------- Goto First Record Loop If Not isempty(Count) $item1 = Item $Count1 = Count Go to Next Record(exit after last) End Loop --------------------- What would be the best way to have $Item1 and $Count1 automatically become $Item2 and $Count2? Or in programming terms $Item[n] $Count[n]... where N is incremented after each record in the loop. The maximum the array will ever be is 12 Seems like it should be simple, but not sure how to do this in FMP.
June 7, 201015 yr Goto First Record Loop If Not isempty(Count) Set variable [ $n; get( recordNumber )] Set variable [$item[$n]; Item ] Set variable [$Count[$n] ; Count] Go to Next Record(exit after last) End Loop But what are you really trying to do with this?
June 7, 201015 yr Author thanks, I will give that a try. I am just trying to temporarily house some data in some variables, so I can then go into another form in an unrelated table and fill it in.
June 10, 201015 yr Author I tried this out... but FMP was giving me an error when I tried to put the array position into the variable. Set variable [$item[$n]; Item ] When I tried to do that... it didn't like the [$n] inside of the variable, said it wouldn't allow those [ ] characters... am I missing something here?
June 19, 201015 yr The [ ] are only displayed in the source code. What you would actually enter in the repetition field of the Set Variable dialog is: $n (Found this by way of Googling to verify that you could actually specify variables/calculations for variable repetitions in a looping script. Would be pretty hard to create arrays in FileMaker if you couldn't.)
June 30, 201015 yr Newbies i'm not sure if i completely understand your need but i would use 'values' to build a chapter of the data. something like … Goto First Record Loop If Not isempty(Count) $itemX = $itemX & "¶" & Item $CountX = $CountX & "¶" & Count Go to Next Record(exit after last) End Loop then use … loop newfield = leftvalues($itemX,1) $itemX = rightvalues($itemX, valuecount($itemX)-1) … end loop or loop newfield = middlevalues($itemX,$loopvar,1) … end loop to unfold the chapter.
Create an account or sign in to comment