Join Cris Ippolite for an in-depth discussion in this video Using calculations in tooltips, part of Advanced FileMaker Pro 12.
Adding a tooltip to layout object is a quick and easy way to provide help or tips or some additional information to your users. It's most commonly applied to layout objects like buttons. For example, if we go into Layout mode and I select this button, you'll see that under the Position tab in the Inspector, and of course, if you can't see the Inspector, you can go under View>Inspector or choose Opt+I or Ctrl+I. I can simply type in some information like Create Invoice and when I save that and go into Browse mode, you'll see that when I hover over the button, up pops a little yellow tooltip called Create Invoice, just some raw text information.
And what you might not know is that you can also use the Calculation dialog to show more dynamic information when users hover over a layout object. So for example, we've got a portal here that shows all the related Invoices to this Customer. So we are in the Context of the Customer Table, as you see here, and then this portal will show Invoices only related to this customer. If we take a quick look here at the Relationship graph, so here's where we are on this layout. We are looking at a portal with related Invoice records.
So here's one Customer as many related Invoice Records, and each of those Invoice records also have multiple ProductInvoice items on them. So it might be interesting for us to see all the different ProductInvoice items that are on an Invoice without leaving the context of this layout. So of course we can drill down through those if we want, or we could maybe add a calculated tooltip that allows users hover over an Invoice portal row and see all the different items on that Invoice.
Now the ProductsInvoices line Item table only contains foreign key values and does not actually contain the name of the products. So really what we would have to do is show a list of related products items, would give us a return delimited index of all the individual products that appear on an Invoice. So a quick idea of what we are going to be doing there. So in this exercise file there is actually little icon here, you'll notice that when I click over this icon, it covers the whole row, well there are some other formatting that is applied to that icon.
So let's use that to be the layout object that we are going to apply the tooltip to. So we go in here little bit of inconsistency in the FileMaker UI. I've mentioned thus far in the course that anywhere you see the specify button, then you can invoke the FileMaker Calculation dialog window, but here in the New Inspector there is a pencil icon, that means the same thing. So anywhere you see the specified button or a pencil, as you can see invokes the Specify Calculation dialog window. So what I am going to do is I am going to use the List function that we covered earlier in this course and the List function of course will provide a return delimited list of values.
As we discussed earlier in the course, if I put a related field as the parameter inside the List function, it'll show me a return delimited list of all the related values. So remember a portal row is actually the context of whatever table it is that we are viewing. So really what we are talking about is, I am in the context of an Invoice Record and I want to see related records from there. So that's really what I'm doing here. So I don't want to pick a related field from customer, because that's the parent of the Invoice. I don't want to pick a related field from the Invoices table, because that's actually what record we are looking at.
Instead I can pick ProductInvoice, I would need to show the Item, but the Item information doesn't exist on ProductInvoice. So I am going to pick Products, where we actually do have the Item information. I'll double-click on Item, pretty simple formula List, and then show the Products and what I am going to do is I am going to add Return character and some text. We can also show the person who Created this, of course, that'll be back up in Invoices. So here's CreatedBy, this shows the list of the products in the Invoice record in the portal, and then also show who wrote up or created that record.
Let's take a look at this in Browse mode. In this particular case what we will do is hover over the icon. So if I leave the hand over the icon, I see that I've got a Performance Tune Up, a Bike Helmet, Accessory Kit, Unisex Sunglasses, and this one was written up by a user Michael Gonzalez. And then when we hover over the next one, we see there is Men's Mountain Bike, Portable Pump, Created By Admin, and so on so, you get the idea. So we can use the Calculation dialog in the tooltip to show dynamic information. Couple quick things on tooltips, if you are going to use this, you should know that the formula is evaluated at the time that the user triggers the tooltip.
So if I'm hovering over this and the value happens to change, it is kind of temporarily stored, but that shouldn't affect this technique that we talked about here. The tooltip won't display if all the Calculation returns as an empty string, it just won't pop anything up. Tooltip text wraps automatically if it exceeds 40% of the Width of the screen. If your screen is very small, the tooltip will exceed 40% of the Width, it'll then wrap. So it might kind effect way that your calculated information is being displayed. Calculation formulas used in tooltips evaluate from the table occurrence context of the current layout, or in our case, the Table Occurrence Context of the portal row.
So keep that in mind, if we've applied a tooltip over here on the left, this would be customer contacts, but here it's the Invoice contacts, so that's something to remember when you're using related values in your Calculations formulas. And things like text formatting, like color, font size, and style, bold, and italic that type of thing will not be displayed in a tooltip, it's just raw text. So you might want to think of things that might be useful to see that don't require bulleted lists, or formatting or different things like that. But the takeaway here is definitely, like in many other areas inside FileMaker, if you use the Calculation dialog and all the formulas of the Calculation engine inside your tooltips, you can do some really compelling dynamic information as you roll over layout objects.
- Managing access to your database
- Parsing text with calculation functions
- Using calculations in field validation and auto enter options
- Creating nested subsummary and crosstab reports
- Creating user-driven and multi-criteria relationships
- Working with intermediate script techniques
- Extending Web Viewer using HTML5 and data URLs
- Sharing databases on a network using FileMaker Server
- Publishing your databases to the web using the Instant Web Publishing or PHP