Make field 1 a calculation that returns TEXT, not number as the formatting probably is adding text (currency symbols maybe?) to the result.
If you check the layouts from FileMaker instead of a web browser, does the calculation with a container type result work?
I'm sorry, I should have clarified. Field 1 is an unstored calculation field, and is set up to return text. It is defined as:
If ( Get ( FoundCount ) > 0 ;
TextStyleAdd ( Get ( FoundCount ) ; Bold )
; RGB ( 169 ; 0 ; 25 ) )
; Get ( FoundCount ) )
Field 2 is also an unstored calculation field, returning a container. It is defined as:
If ( Get ( FoundCount ) > 0 ; Globals::Red ;
//Globals::Red is a global container field containing an image of the shade of red I want to show as a button color.
//similarly, Globals::Gray is the shade of gray I want as a button color
These fields do appear correctly in their layouts when viewed from FileMaker. But from the web, Field 1 just returns the found count, with no formatting, and Field 2 returns a 'broken image' icon.
Please let me know if there's anything else that would help with troubleshooting (details of relationship from Table A to Table B, file structure, etc).
Do "Globals::Red" and "Globals::Grey" have global storage specified?
Have you checked from a CLIENT fileMaker pro system to make sure that they have the expected values? (When hosted, changes made to a global field on a client are not retained when the client closes the file nor are the changes visible to other clients.)
Yes, they're both specified as global storage. And I can't check from a client FM Pro system, but from FM Go on my iPad (accessing the file my laptop is hosting), both Field 1 and Field 2 are rendering correctly in the layout. Besides, the hosted UI file (I'm using a data separation model, where the file containing all the records is also hosted, but all layouts are in the hosted UI file) doesn't have any layouts to even see the Globals::Red or Globals::Gray fields, so they're definitely not changing them.
I just discovered an interesting thing about Field 1 - a button on a layout whose text is a merge field of Field 1 will only show the found count, without any formatting, when viewed in IWP. However, a merge field of Field 1 by itself shows the proper formatting when viewed in IWP. Is that a documented bug?