Good Evening FileMakers,
I have a list view layout and I would like to hide an object for all but the active record / row. Any suggestions?
Use OnRecordLoad trigger to do this:
Set Variable [ $$RecordID ; value: Get ( RecordID ) ]
give the object this hide object when expression:
$$RecordID <> Get ( RecordID )
you may need Refresh Object after setting the variable.
FMP17 introduced a new script step FileMaker Pro 17 Advanced Help Get(ActiveRecordNumber)
Get(ActiveRecordNumber) <> Get(RecordNumber)
or the example from FMP17 help
not ( Get ( RecordNumber ) = Get ( ActiveRecordNumber ) )
Why not just query all the active records? You can do that manually or use an OnLayoutEnter trigger.
A quick low-tech method would be to make the object the same color as the active row color. (I'm assuming you're using a list with an active row color.) You didn't say what this object is, but I'm thinking of the scenario where there is a button on a row, or something similar.
Hide Object When is better, especially for buttons as you can still click a button that's camouflaged to match the background where a hidden button cannot be (and you don't get any "hover effects" either.)
It also will not need modification should a future edit change the background color.
I read the OP wrong. I thought he was trying to hide inactive records in a list. I re-read and now see that he only wants to hide an object.
I'd go with philmodjunk's suggestion of using a Hide calculation on that object.
I can't get this to work consistently in the List view.
Using the Current found set Portal, it works, but there's weirdness in a list view. I wonder if this function is not meant for the list view.
Clicking in a list row doesn't unhide the button. Only when I use the arrows in the menu bar.
That would appear to be a bug too me.
According to the description :
Get(RecordNumber) Returns a number representing a record's position in the current found set.
Get(ActiveRecordNumber) Returns a number representing the record that has focus in the current found set.
If you create non-stored calculation fields the fields update correctly.
Dropbox - hideObjectTest.fmp12
I reported as a product issue maybe FMI will comment about the issue.
I wonder if its only really meant for the CFS portal. Most times I wouldn't have a list view where i care about the active record.
But i'm interested to know what FMI thinks.
The example does state portal, but I can see cases where it would be beneficial to work outside of a portal as in the above example.
The documentation should state portal only if that is FM intentions.
Here is where I reported it. Get(ActiveRecord) does not work correctly Hide when calculation.
TSGAL did respond.
FMI states it is by design. That I need to use refresh object or refresh windows. It basically works the same way as the method philmodjunk describes but, you don't have to use variables. In my example file I modified to use a script trigger on record load with refresh window and it works. Even the other method mentioned states may require refresh object.
Just create a statistic field in your table that counts the current number. Then hide your portal object(s) in the inspector with "fieldName" <> Get(ActiveRecordNumber). Done.
Retrieving data ...