Click OK to close the pop-up window. Set your state data as the first input, and your sales data as the second input. Your fifth rule in the Convert Data Panel should look like this:
We are almost done, the only thing looks not so great is that for the state does not meet our criteria, there is an empty line of the output. To get rid of this, simply use Vect’s filter data rule:
Click “Insert”, and select “to filter data from other rules based on a pattern”.
Simply use our own rule as the input:
All right!! Now we’ve got everything right. To double check, click the small triangle between the rule number and rule name, make it a red one, like you’ve seen in the picture above. You can see the entire output, the last line of the output should be:
Yes, we have 42 states who have tobacco sales more than 100.
Next you should format the output and generate the Perl code, the whole procedure is almost the same as that in the tutorial “Numerical Data Extraction”, so please refer to the Section 5 and Section 6 in that tutorial for details.
What you have learned from this tutorial:
- An in-depth understanding of each element in the user-defined program, including:
- The usage of the “global” variable. (remember $count ?)
- How to output the “global” variable at the end of the program execution.
- How to make part of the code in you program conditional.
- How to use Pattern Rule to delete empty lines in the output data.
Written by Song Li
Dec 2005
|