Facebook Likes Task

Description

Facebook Likes Task extracts a recent list of pages favourited by a given Facebook ID.

Tutorial

Configuring Facebook Likes Task

Similarly to adding other SQL Server Integration Services (SSIS) tasks, the Facebook Likes Task shown in Figure 1 can be added onto the Control Flow pane in the following manner;

  1. Drag-and-drop the Facebook Likes Task into the Control Flow, or
  2. Double clicking the Facebook Likes Task
Facebook Likes Task - SSIS Toolbox

Figure 1

By default the Facebook Likes Task will throw validation errors shown in Figure 2.

Facebook Likes Task - Validation Error

Figure 2

To resolve the validation errors, we need to configure the Facebook Likes Task by using its editor (Facebook Likes Task Editor).

Facebook Likes Task Editor

The Facebook Likes Task has four parameters:

  1. Facebook ID – Facebook ID to search for. It has a maximum character value of 500 and default value is 160836574053016. For information on how to retrieve a Facebook ID, see Facebook Search Task
  2. Count – Number of favourited pages to return. The maximum value is 100 and the default value is 20. Please note that if you specify a higher value, the greater are the chances of the Facebook Likes Task taking longer to execute.
  3. Save To – Path wherein the generated file will be stored. If you can, try to keep the length of the path as short as possible.
  4. Save As – Only JSON file type is supported. There are many tools and applications available on the internet to deserialise the JSON file. We recommend also considering using JSON built-in functions in SQL Server 2016.

Set Absolute Values

Providing absolute values for the parameters refers to hardcoding the values into the textboxes. This basically means that everytime you execute the task you have to manually set the Facebook ID parameter value like I have manually entered 102038129831681 shown in Figure 4.

Faceboook Likes Task - Absolute Value

Figure 4

Dynamically Set Values using Expressions

Instead of manually capturing values for the parameters, we can dynamically set them using package expressions. Expressions reads data from package variables at runtime. To configure expressions, click the Ex button. This will open up a Choose Variable dialog box. You can then select the variable you want to use and click the OK button.

Facebook Likes Task - Choose Variable

Once you have clicked the OK button, you will be redirected back to the Facebook Likes Task with textboxes set to variable names.

Facebook Likes Task - Expressions

Executing Facebook Likes Task

The execution of the Facebook Likes Task is usually quick. Similarly to executing other SSIS tasks, the simplest way of executing Facebook Likes Task is to right-click your mouse button, navigate to and click Execute Task option as shown in Figure 7.

Facebook Likes Task - Execute Task

Figure 7

If the configuration is done correctly, the Facebook Likes Task execution should be successful as shown in Figure 8.

Facebook Likes Task - Execution

Figure 8

The file generated after executing the Facebook Likes Task is shown in Figure 9 and it is prefixed with SST_FBLikes_ followed by a date and time stamp.

Facebook Likes Task - Flat File

Figure 9

A preview of the data contained in the file shown in Figure 9 is shown in Figure 10.

Facebook Likes Task - Flat File Preview

Figure 10

Additional information

Additional Informational & Progress Events

Facebook Likes Task - Package Explorer

Figure 11

As the Facebook Likes Task is being executed, it is important to take note of two additional information events that will appear in the Execution Results tab in the designer. As indicated in Figure 11, these two informational events basically describe the parameter values that are being used during task execution. This information could be useful during troubleshooting, especially in cases where Expressions are used to set parameter values. Finally, during package execution, the package will constantly report on the progress of the execution.