Sometimes it can be difficult to get the Web Viewer calculation to reload its contents based on field values. To help fix this issue, we have introduced a function called BlackBoxRefresh which can be used as the final parameter to any BlackBox function call in order to trigger a refresh of the BlackBox contents.
BlackBoxRefresh( field ref {; field ref } )
The BlackBoxRefresh function accepts any number of parameters. These parameters are field references that cause the Web Viewer to refresh when the values in those fields change.
For example, the field MyTO::MyID is an ID field which sets the relationship for your
tagger. You want to show the tags through that relationship, but the Tagger BlackBox isn't refreshing the Web Viewer when the ID in that field is changed.
While this example uses the Tagger function, all BlackBoxes created by FusionPlugins and by third party developers automatically support this feature.
If this is the Tagger calculation you are having problems with:
// The Tagger only requires the field name, and can be used in a related field.
Tagger( "MyRelatedField::MyTags" )
To force through the update whenever the value of MyTO::MyID changes, you can use the BlackBoxRefresh function as follows:
// Using BlackBoxRefresh to reload the bb when the value of MyTO::MyID changes.
Tagger( "MyRelatedField::MyTags" ; BlackBoxRefresh( MyTO::MyID ) )
Note that the parameter we are supplying to BlackBoxRefresh() here is a proper FileMaker field reference, not quoted text giving the field name. While it might be tempting to supply local or global variable references here as well, we have found that that doesn't actually work (refreshes are not triggered), due to the way that FileMaker's calculation engine works.*
You may have noticed that the Tagger BlackBox has various other optional parameters on the end. The BlackBoxRefresh() function is unique in that it is an implied final optional parameter to all BlackBoxes. That means you don't include it in the parameter list when you are creating a BlackBox. It is just 'always available' for use as the very last parameter, and always has the same effect: if its value changes then the Web Viewer will refresh.
For example, the following would work in the same way as the Tagger() call above, but allows us to use the other optional parameters in the Tagger function:
// It will work on any BlackBox function as long as it's the last parameter.
Tagger( "MyRelatedField::MyTags" ; "" ; "" ; "#eee" ; BlackBoxRefresh( MyTO::MyID ) )
Note that although the above example causes a refresh only when MyTO::MyID changes, you can have as many different fields as you like triggering refreshes: do this with a single BlackBoxRefresh() call that lists all of them as its parameters.
Technically, it is possible to supply any literal values, or any other FileMaker function's results as parameters to BlackBoxRefresh().
MonitorIntegrityOfBasicMathematics( BlackBoxRefresh( 2 + 2 ) )
MyBlackBoxFunction( BlackBoxRefresh( MyCustomFunction() ; Get( ActiveFieldName ) ) )
Comments