Welcome Guest, you are in: Login

QVSource: The QlikView & Qlik Sense API Connector (Docs)

QVSource QlikView Script Library

RSS
Modified on 2016/04/01 09:47 by chrisb Categorized as advanced, demo apps

/*****************************************************************
/ Standard QVSource library
/ http://www.QVSource.com
*****************************************************************/
let today = now(1); // 1=at time of function call
let year = year(today);
let month = month(today);
let day = day(today);
let timeStamp = $(day) & '_' & '$(month)' & '_' & $(year);

// let test='hash # Dollar $ Ampersand & Plus Comma , Slash / Colon : Semi-colon ; Equals = Question mark ? At @ sq left [ sq right ] backslash \ quote '';
//
// Reusable function url encode text 
// Useful, for example, in sentiment connector and for search table in Twitter connector.
//
//
// NOTE: URL encoding should be done using UTF-8.
//
Sub urlEncode(str)

	let str=replace(str, '%', '%25'); // should be first
	let str=replace(str, '#', '%23');
	let str=replace(str, ' ', '%20');
	let str=replace(str, '$', '%24');
	let str=replace(str, '&', '%26');
	let str=replace(str, '+', '%2B');
	let str=replace(str, ',', '%2C');
	let str=replace(str, '/', '%2F');
	let str=replace(str, '\', '%5C');
	let str=replace(str, ':', '%3A');
	let str=replace(str, ';', '%3B');
	let str=replace(str, '=', '%3D');
	let str=replace(str, '?', '%3F');
	let str=replace(str, '@', '%40');
	let str=replace(str, '[', '%5B');
	let str=replace(str, ']', '%5D');
	let str=replace(str, '>', '%3E');
	let str=replace(str, '<', '%3C');
	let str=replace(str, chr(10), '%0A'); 	// Line feed.
	let str=replace(str, chr(39), '%27');	// 39 Apostrophe
	
	call=str;
		
End sub

//
// Set a default to email address at the application level
//
let emailNotificationAddress = 'username@domain.com';
 
//
// Reusable function to send email. Note that you will need to 
// set the account details and smtp server in the connector's user interface for this 
// to work server.
//
// Usage:
// call sendEmail('test subject', 'test', $(emailNotificationAddress));
//
sub sendEmail(subject, msg, to)
 
    NotificationConnector_SendEmail:
    LOAD
        sendemail_status as SendEmail_sendemail_status,
        sendemail_result as SendEmail_sendemail_result
    FROM
    [http://localhost:5555/QVSource/NotificationConnector/?table=SendEmail&subject=$(subject)&Test Subject&message=$(msg)&to=$(to)]
    (txt, utf8, embedded labels, delimiter is '\t', msq);
 
    drop table NotificationConnector_SendEmail; // Comment this out if you need to debug and see the results of the send attempt.
     
end sub


(QVSource works with Qlik Sense as well as QlikView - See this page for notes.)
QVSource - The QlikView & Qlik Sense API Connector | © Copyright 2011 - 2016 Industrial CodeBox Ltd