Welcome Guest, you are in: Login

QVSource - The QlikView API Connector (Docs)

»

RSS RSS

Navigation

For Everyone
For QlikView Users
For Advanced Users
For .NET Developers
If you like QVSource please consider showing your interest and support.





Search the wiki
»

Wiki Links


PoweredBy

PeerIndex Connector for QlikView

RSS
Modified on 2012/03/18 15:05 by chrisb Categorized as connector, demo apps, social

The PeerIndex connector connects to the PeerIndex API allowing you to retrieve data on the audience, authority, activity and topics for Twitter users loaded into your QlikView application. See this page for more detail on the scores and other data provided by PeerIndex.

This connector can be used in conjunction with the QVSource Twitter Connector.

Usage

Using the connector is as simple as requesting an API key from PeerIndex (see link in connector user interface) and then entering the Twitter user name of the user who you wish to lookup.

Image

The connector provides a single table containing the data returned by PeerIndex. By default this connector will cache the response for 48 hours before rerequesting the data from PeerIndex.

Image

As with all the connectors you can use this to copy and paste the script template to your QlikView application:

Image

You would then most likely alter it to loop through a table containing your list of Twitter user names and substitute the 'user' parameter in each iteration of the loop. The following section illustrates this.

Sample Script & Demo Application

The following script illustrates how to run a search for Tweets containing the specified search term and then run each of the Twitter users in the search results against the PeerIndex connector. The script also splits out the comma separated topics into a separate table.


let twitterSearchTerm = 'qlikview';

TwitterConnector_Search:
LOAD
	created_at as Search_created_at,
	entities_urls_url as Search_entities_urls_url,
	entities_urls_expanded_url as Search_entities_urls_expanded_url,
	entities_urls_display_url as Search_entities_urls_display_url,
	entities_urls_indices as Search_entities_urls_indices,
	entities as Search_entities,
	from_user as Search_from_user,
	source as Search_source,
	text as Search_text,
	to_user as Search_to_user
FROM
[http://localhost:5555/QVSource/TwitterConnector/?table=Search&searchTerm=$(twitterSearchTerm)&searchmaxpages=15&&fixedcolumns=false&format=html]
(html, utf8, embedded labels, table is @1);

LET noRows = NoOfRows('TwitterConnector_Search');
    
for i=0 to $(noRows)-1
 
    let user = peek('Search_from_user',$(i),'TwitterConnector_Search');
 
	PeerIndexConnector_Profile:
	LOAD
		name as Profile_name,
		twitter as Profile_twitter,
		twitter as Search_from_user,
		slug as Profile_slug,
		known as Profile_known,
		authority as Profile_authority,
		activity as Profile_activity,
		audience as Profile_audience,
		peerindex as Profile_peerindex,
		url as Profile_url,
		topics as Profile_topics,
		status as Profile_status
	FROM
	[http://localhost:5555/QVSource/PeerIndexConnector/?table=Profile&user=$(user)&format=html]
	(html, utf8, embedded labels, table is @1);
 
next

PeerIndexConnector_Topic:
LOAD
    Search_from_user,
    trim(subfield(Profile_topics, ',')) as topic
Resident PeerIndexConnector_Profile;

Note that if you wanted to loop through a field of Twitter user names the code would be more like this:


let users = fieldvaluecount('Search_from_user');

for i=1 to $(users)
	
	let user = fieldvalue('Search_from_user',$(i));
				    
	PeerIndex_Profile:
	LOAD
		'$(user)' as Search_from_user,
		name as PeerIndex_name,
		twitter as PeerIndex_twitter,
		slug as PeerIndex_slug,
		known as PeerIndex_known,
		authority as PeerIndex_authority,
		activity as PeerIndex_activity,
		audience as PeerIndex_audience,
		peerindex as PeerIndex_peerindex,
		url as PeerIndex_rl,
		topics as PeerIndex_topics,
		status as PeerIndex_status
	FROM
	[http://localhost:5555/QVSource/PeerIndexConnector/?table=Profile&user=$(user)&format=html]
	(html, utf8, embedded labels, table is @1);
	    
	call logQVSourceError(scripterrordetails, 'PeerIndex\PeerIndex for user $(user)');
				
next

PeerIndex_Topic:
LOAD
    Search_from_user,
    trim(subfield(PeerIndex_topics, ',')) as PeerIndex_topic
Resident PeerIndex_Profile;

The results is a schema which looks like this.

Image

The following is a sample dashboard containing the above script. You can download this application here: QVSource PeerIndex Connector Demp App - V1.qvw

Image

Change Log

0.9.1 - 18/03/12
  • Minor performance improvements.
  • Upgraded to V2 of the API.
  • Added TopicsScore and BenchmarkTopics tables.

0.9.0 - 20/01/12
  • Initial Release
© Copyright 2011 - 2012 Industrial CodeBox Ltd