Jump to content
Salesforce and other SMB Solutions are coming soon. ×

Calculation based on global field value


jazbek
 Share

Recommended Posts

Hello,

 

Thanks to Ender, I now have a database that functions well to show related records based on a relationship between the related table and a global popup field in my main table. (See http://filemakertoday.com/com/showthread.php?t=10376 ).

 

For the sake of example, I basically have:

 

mainTable relatedTable =

mainTable::MainID = relatedTable::MainID

AND mainTable::gField = relatedTable::relatedField

 

The next thing I want to do is to have a field on each record that contains something along the lines of "no related records exist for this record", or displays nothing if related records exist. I have a calculation:

 

If ( Count ( relatedTable::relatedField ) > 0 ; "" ; "no related records" )

 

The calculation works, but only if I actively select the value for gField when I have the record open. How can I trigger the calculation to be evaluated whenever the record is displayed?

 

Please let me know if you need further clarification or an example file. Thanks in advance!

Link to comment
Share on other sites

I am not sure I understand this. This calculation should have the option "Do not evaluate if all referenced fields are empty" deselected. But if it doesn't, then it shouldn't work at all - so I don't know.

Link to comment
Share on other sites

Yeah, I have tried it both with and without that box checked. Same result. Field does not calculate unless I click in the global popup field.

 

Anyone know of any other ways to display a message on a layout if there are no related records? It just looks wrong having 3/4 of my layout full of blank fields...

Link to comment
Share on other sites

I figured it out!

 

Stupidly, I was using a text field with an auto-enter calculation.. instead of just a calculation field. It's been a while since I've used Filemaker, and I guess I'm still getting warmed up!

 

Thanks for your time. :)

Link to comment
Share on other sites

Not without seeing the file. Trouble-shooting is a matter of elimination, so I would make another calculation of just

Count ( relatedTable::relatedField )

and also place a portal on the layout. That should help in locating the source of the problem more precisely.

Link to comment
Share on other sites

Bah, it was giving me the "?" when the calculation went onto 2 lines (when either there was a break in the data entry, or the calculated result was too long to fit in the field box). Thanks again.

Link to comment
Share on other sites

 Share



×
×
  • Create New...

Important Information

Terms of Use