How can I set a variable to the value of GetFoundCount in a filtered, single row portal?
I've tried naming the portal and the GetFoundCount object in the portal and using GetLayoutObjectAttributes (content) but that is not working for me.
To set field (on layout) value to variable, you can use "Hide object when" calculation
Let ( $$variable = Self ; 0 /* never hide */ )
try defining a calculation field in the related TO that = Get ( FoundCount )
Get found count respects the relationships on the graph but does not respect portal filters. You would have to set up a relationship that duplicates your portal filter condition and the portal relationship. if you need the value in a script perhaps you would use set variable to an ExecuteSQL() statement to get the found count value? The good thing about ExecuteSQL is that you don't have to build extra graph objects to get what you need.
PS your first line suggests that you are encountering a fundamental misinderstanding of variables and portal objects. Please explain exactly what you are trying to do so we can figure this out and increase your knowledge of FM.
Thanks very much. I've wondered whether there was any way to get this value
by naming it but it sounds like the answer is now. The SQL approach or the
special TO approach mentioned by Peter Doern would both work. I was just
trying to avoid more TO and field clutter.
I presumed that, if you're putting this value in a portal, that there is a TO already defined. No extra TOs required.
Get found count respects the relationships on the graph but does not respect portal filters.
Right, thanks for that important detail.
Or you might want to take a new look at GetLayoutAttribute. I haven't tried it but others have reported using it successfully.
I tried GetLayoutObjectAttribute with no luck.
In a one-row filtered portal, I have inserted the symbol for FoundCount. It
displays the correct value. I assigned a name to both the portal and the
I tested in Data Viewer.
Evaluate results are blank. I tried with the object name for the portal and
the FoundCount symbol. I tried with and without quotes. No luck.
Do you see any syntax or other type of error based on this description?
if you have a summaru field nd you want it tou summarize your filtered results then you duplicate your portal (with the same filter options), you keipp it one line and inside the portal row you place the summary field and it shows the filtered summary
Thank you. I do not have a Summary field. I know I "could" and I know there
are other ways to do what I want. But, as I learn more about FileMaker, I
was curious to know if the technique I'm writing about is even possible
because it would reduce the number of fields and require less TO
Basically, I'm counting related records with FoundCount in a single-row,
filtered portal. I want to get the value of FoundCount into a variable
where I can use it for some additional calculations.
On Tue, Feb 28, 2017 at 11:41 AM, MichaelManousos <firstname.lastname@example.org>
I can use GetLayoutObjectAttribute to get the value of either a summary field or the found count layout object when I try it.
Compare your solution to mine and see what might be different.
I included unstored calculation fields so that you can see the exact expressions that I tested in the data viewer.
Thanks, User19752. This seems to be exactly what I want. No additional fields or relationships needed and I can use the variable for subsequent calculations.
FMP (and this User Forum) never ceases to amaze me.
A word of caution about using Hide Object When and Conditional Format expressions to assign values to variables. This works now just fine, but at least one FileMaker Inc engineer has advised against using it as may fail to assign a value at the right time in future versions. This is due to changes they plan to make in how a layout updates.
Thanks very much for this word of caution. I did some experimentation with it and it worked perfectly but I'll take a different approach if this "feature" may be removed in future releases.
FYI -- I took a quick look at the example file you sent yesterday showing your results with GetLayoutObjectAttribute. Thanks for taking the time to do it.
I tried to do a quick test using the Data Viewer in your file. GetlayoutObjectAttribute did not work in the Data Viewer in my very quick test and I'm wondering if that function may never work in the Data Viewer because is it layout dependent. Do you know?
It worked in the data viewer for me. The two expressions in the unstored calculation fields were copied directly from watch expressions in the data viewer. I was using FileMaker 15 in windows.
They aren't removing the feature, but planned changes in how the layout updates could result in the merge variable being "drawn" before it is assigned a value.
I noted this too at that engineer session at DevCon but it seems to me -- in this instance anyway -- that if the Hide When condition relies on Self then FileMaker would naturally be forced to evaluate the merge variable first, don't you (or do you) think?
Possibly, but it's not something that I would count on until the changes take place and I can test it. The variable should get the correct value, but the text object containing the merge variable might not update to show the new value.
There are other options for how to do this so I go with something in which I have more confidence that it will work with future versions.
I just tested again in the Data Viewer and it worked as you said in your example file.
Didn't want to leave this open.
Now, I'll go back to my solution to see if I can incorporate.
Thanks for your help.
Retrieving data ...