We’ve covered Notes’ live text feature before in the hallowed pages of dadams.co.uk, but this time we’ll dig a bit deeper and show a real-world example. Let me first thank Mikkel Flindt Heisterberg, as his post helped me clarify some of this. I knew the basic concept but needed a little help, and his post gave me what I needed.

A quick intro for anyone who doesn’t know what live text is… Notes has the ability to recognise a set of characters and associate an action with them. Out of the box Notes will recognise people’s names and e-mail addresses… the obvious thing to do with a name is click on it and look up the person in a solution such as, oooh, IBM Lotus Connections Profiles. You can also teach Notes to recognise things like post codes, and then perform associated actions like find the place on a Google Map, look at the local weather, or find the nearest restaurant or wi-fi hotspot. You can teach Notes to recognise account numbers, part numbers, projects codes… anything that is formed of a recognisable string of characters… such as flight numbers.

So here’s the scenario. I receive an e-mail from a colleague saying they’re travelling on British Airways flight number 1541, and it’s typed in as BA1541. That’s easy to recognise using the following regular expression (or some other variation of it):

[BA]([0-9]{3,4})

That’s ‘BA’ followed by three or four digits which range from 0 to 9, and this recogniser means that BA1541 will be recognised as live text… once there’s an action associated with it. The obvious action is looking up that flight number on the BA web site, but here’s where it gets tricky. The BA web site doesn’t want BA1541 passed to it, just 1541 because it assumes that the BA is a given. So 1541 has to be extracted from the value, and this is where groups are used. Look at the regular expression above and you’ll see that the part which defines the flight number (not the operator, BA) is contained within parentheses – this creates a group.

As luck would have it, for the BA flight information that’s all you have to do. As the one and only defined group, just the number (not the BA) is passed to the BA web site and the live text action works. So let’s look at a slightly more complex example.

FlightView.com also allows you to look up flight details, and not just BA flights. But FlightView requires that the airline code (the two letters) and the flight number (the digits) are entered into separate fields. As we’re no longer just looking for BA flights, the regular expression needs to change, and also needs to define two groups and cater for two digits… so it now looks like this:

([A-Z]{2})([0-9]{2,4})

Now let’s build that widget. Start off by clicking on the widget icon in the Notes toolbar (it looks like a jigsaw piece) and select ‘Web Page’. In the next dialog box select ‘Web page by URL’ and then enter http://flightview.com. In the next dialog box select the ‘From a form on this web page’ option and hit the Next button. You’ll then see the following form:

The wizard will work out the available web-based forms to fill in, and present them at the top of this dialog box. Selecting the right one will turn the fields green showing that this is the form that you want. Select Next. On the Basic tab of the next dialog box you can set the widget’s name – you should also select ‘Wire as an action’, and then go to the Advanced tab. In here you’ll tell the wizard that you’re going to use the airline and flight number fields, but not the airlines from the provided drop-down list… so set out the dialog box as follows:

In the next dialog box you’ll need to configure a recogniser – press the New Recogniser (the Americans spelt ‘recogniser’ with a z) and fill out the dialog box as follows – but first create a new content type:

After clicking OK you’ll get back to the main wizard – ensure that you have clicked the option for ‘Recognised content’ and select the recogniser you just created. I would advise selecting ‘Tab’ for the option of how users see the results, but that’s up to you.

Now switch to the Advanced tab. One of the content type properties will already be set, but you’ll have to click the Add button and add the other content type, as seen below:

Click the Finish button and you’re done. Now you’re ready to check if this works (it should do) – add some flight numbers into a new e-mail and save as draft. Preview the draft e-mail and the flight numbers should show a blue dashed underline. Click on one and you should see the flight number broken into the two parts and passed to the home page of flightview.com – and then the results. Bear in mind that FlightView works best with flights that are currently in the air or scheduled to leave soon.

If you also created a British Airways specific widget you should notice that BA flights will be recognised by both your BA and FlightView recognisers, so it’s best to set a default action. If you base the British Airways widget on the recogniser built here, you run the risk of associating non-BA flights with the BA web site, so it’s best to build a BA-specific widget and set that as the default action for BA flights. On the plus side, you’ll be able to create a dashboard from the two actions, providing a BA and FlightView view of the flight in question… click on the image above to see an example.

0