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

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

Recommended Posts

Posted

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.

Posted

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?

Posted

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.

Posted

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

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
Posted

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.

This topic is 5260 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.