Posted 09/14/2010 - 13:15 by chriswarner
I hope you’ve been keeping up with all the great App Tips blogs here on the Community. A few weeks back we highlighted the 'Advanced Mode' in App Maker. Now, instead of faking an illness to stay home and play the new Halo Reach, I decided to help you make a little less noise with the Filter Block in Wires.
I'm sure you'd agree that looking through a ton of information on a daily basis is exhausting. I find myself double-tapping 'Ctrl' (for my fellow Google Desktop users out there) to find information all the time. And I know you often want to reduce the 'noise' in your Apps or Mashups too. So we're going to use the Filter Block in Wires to make an incoming data source more relevant. This is one of those 'very simple but very useful' techniques that separates a basic mashup from an extremely powerful one.
Let's start with a single, simple RSS feed. Find an existing RSS feed (or add one), open Wires and add the feed to your Wires canvas, and then add an empty 'Filter' block to your canvas as well (you'll find 'Filter' on the 'Blocks' list). Next, connect the RSS feed to the Filter Block. Then select the Filter block and you will see a cool set of options show up in the lower-left hand corner of the screen.
At this point you can point-and-click your way through selecting what you want to filter and how you want to filter it. Since you can have as many conditions as you like (see the 'Add Conditions' box?), let's put a second Filter on our example with a search on both 'Title' and 'Description' in the RSS feed. It should look something like this:
And your canvas will look like this:
Now every time this simple Mashup is executed, it will filter the incoming RSS feed based on whatever value(s) you put into these 4 fields. But we can make our filtered Mashup much more flexible. See that magnifying glass next to the filter value field? Click it and you'll get a pop-up box with various options, like this:
From this list, choose '[Add as Input]'. Once you do that, you'll see that Wires adds a new block to your Mashup. In the picture below, I did that and renamed the it something friendly, 'Filter Input', which you can see in my example below:
And you'll notice your Filter options include this new block as well:
Why bother? Didn't we already have a filtered Mashup without this extra step? Yes...but no. Sure, your Mashup would still filter out the noise without this new-fangled block. But this new [Add as Input] block makes it possible to invoke or run the Mashup by other Mashups with a parameter. In other words, you use the Mashup and filters on whatever values are passed in as a parameters (or, if you don't specify values, the default value is used...so make sure you pick helpful default values!).
This simple Filter parameter can, in effect, make a single Mashup into many Mashups. One community member described it to me this way: 'I made a Mashup on competitive news, collected from dozens of news sources. The filter lets my coworkers take the mashup and make it unique to them and the topic they care about. One Mashup, many uses.'
You can learn more about the Filter Block in the Presto 3.0 documentation. And, as always, remember that these App Tips aren’t a substitute for the Documentation, or the full-featured ‘How-Tos’ here on the community. And here's a preview of the next App Tips blog: we're going to turn a Filtered Mashup into a fancy App, with user-input boxes for our Mashup parameter.