Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

Indexing a Portal field from a calculation


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

Recommended Posts

Posted

OK, I'm stumped. Pardom for the newbie type question.

Is there a relatively simple way to access field 'X' of row 'N' of a portal in a calculation, ie:

MyRelationship::MyField[4]

Which would access field 'MyField' of the 4th (or 5th, depending on your viewpoint) row in the portal?

I assume there's probably a way to do this with a script but I'd prefer to have it automatically calculated.

Posted

Ohhhhhhhhkay, then how about an incredibly complex and convulted way? I mean, there has to be a way to do this - this is such a common programming type scenerio I can't believe there isn't some way to do it...

Posted

Hi,

May be you could explain us a bit more about what you're after, because I cant see any common scenario where I'd ever want/need to do it this way...

A portal has a variable size of rows, which content varies from the sort order and which fields are those you defined them to be when building the portal, unless they are aliases of fields involving GetField ( ).

There must be a better way to set this 4th or 5th row in my opinion, for example using a calculated key grabbing the ID of this record in the 4th or 5th row, and using it for a relationship to this record.

Tell us more.. smirk.gif

Posted

I'm guess I'm not explaining myself. frown.gif

All I'm trying to do is iterate down the rows of the portal to -retrieve- the values of a few of the fields in each row (the data is being written to a web page). Even though I know the sort order it's irrelevant in this case as it doesn't matter what order I pull the data out.

Perhaps I've got a naive view of portals in FileMaker but from my programming background they look and smell a lot like an array so naturally I just want to index into the portal by the row and snag the field values I want. The Count() function returns the number of rows in the portal, so that's a good start. "MyRelationship::MyField" just returns the data for the first row of the portal and I can't find the trick to indexing the next row.

So what am I missing? Obviously I'm not the first to want to do such an incredibly common thing...

Posted

So you want to build an index from a related field.

The ValueListItems ( ) function would be a start but you'd need each field to be indexed and a value list created for each field. And this wouldn't account for duplicate entries.

One other option would be to use a calculated field in the related file with a structure of GetField(MyGlobalValue).

Then, you'd decide which field you want the index by setting the 'MyGlobalValue' in the related file, and you'd then *brutally* catch its content through a CopyAllRecords script.

Search the forums for this "Copy All Records".

Posted

Well you can before and after or even item N'e within the result of following AS

tell application "FileMaker Pro"

get first record

end tell

...it behaves like this

{"1", {"aa", "bb"}, {"cc", "dd"}, {"ee", "ff"}}

1 is in the table where the portal is shown, aa and bb in the first curly paranthesis inside the main curly is first coloumn in the portal ...this means that ee and ff is the last coloumn inside the portal. This means that the result here is the one from a TWO rows portal!

But then is it just the struggle to get the syntax working to the items you're after smile.gif

--sd

Posted

Or you could create a value list based on the related primary key and set a global with

Substitute( MiddleValues( ValueListItems( Get(FileName); "yourvaluelist" ); N; 1 );

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