Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

$variable array

Featured Replies

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.

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?

  • 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.

  • 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?

  • 2 weeks later...

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.)

  • 2 weeks later...
  • 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

Important Information

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.