CG0129inz - FÆRGEN A/S Kundepanel - Import email info to base questionnaire

From Catglobe Wiki
Revision as of 09:05, 6 February 2012 by Cg huyphong (talk | contribs) (Created page with "== General information == {| border="1" class="VerticalTable" |- ! style="background-color: rgb(244, 219, 165); text-align: center;" | <br> ! style="background-color: rgb(244,...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

General information



Site
inzights.catglobe.com
Catinét project no
0129inz
Client

How to send out reminders

Goal

This is a standard setup to import the file which contains the email address to the base questionnaire then send the invitation to the imported email.

How to do

The general solution is to execute the .exe program to upload the csv file. After it is uploaded, the workflow script will validate and import the uploaded info to the base questionnaire.

Step 1 : Create the list of email address

We create the ".csv" file containing the email address like

File containing the email address.jpg

Step 2 :Prepare the workflow script for solving the uploaded data

array a = Workflow_getParameters();
string csvData = a[0];

number DCSRid = 1497859; // DCS : used for filtering the email. The real value should be : 1497858
number EmailgroupRid = 1497862; // EmailgroupRid : used for contatining the import Email.
number PQRid = 1497857; // PQRid: used for the imported PQ. The real value should be :  1289245
number bulkmailId = 1548; // bulkmailId : used for sending the invitation. The real value should be : 1549
DCS_use(DCSRid); 
DCS_rebuild();
//Sub workflows for data resolve
number  info_wfrid = 1293521; //CG0129inz - FÆRGEN A/S Kundepanel - get info from the record on csv file
number validate_info_wfrid = 1497863; //CG0129inz - FÆRGEN A/S Kundepanel - Validate the email csv info
number optimize_wfRid = 1497864; //CG0129inz - FÆRGEN A/S Kundepanel - Optimize the email csv record
number createQAS_wfRid= 1497865; //CG0129inz - FÆRGEN A/S Kundepanel - create qas n base qnaire
number import_wfRid= 1497867; //CG0129inz - FÆRGEN A/S Kundepanel - Import email data

array currentdatetime = getCurrentDateTime(Timezone_Romance_Standard_Time);
number currentvalue = currentdatetime[DateTime_Year]*10000 + currentdatetime[DateTime_Month]*100 + currentdatetime[DateTime_Day];

//start get the upload csv file
string empt = empty;
CsvReader csv = new CsvReader(csvData, true, ";", "'", "\"", empt, true, false);
number fieldCount = csv.FieldCount;
array addToSurvey;
array headers = csv.Headers;
while(csv.ReadNextRecord()) {
Dictionary csvinfo = Workflow_call(info_wfrid, {fieldCount, headers, csv});
if (Workflow_call(validate_info_wfrid, {csvinfo,DCSRid})== true)
 {
	  addToSurvey.Add(csvinfo);
 }
}
if (isEmpty(addToSurvey) == false) 
{
	//Remove the duplicate email
	addToSurvey = Workflow_call(optimize_wfRid,{addToSurvey});
	//create qas and import		
	addToSurvey  = Workflow_call(createQAS_wfRid,{PQRid,EmailgroupRid,addToSurvey});
	Workflow_call(import_wfRid,{addToSurvey,PQRid});
	//send bulkmail
	string guid = getResourceGuid(Resource_Type_BulkMail , bulkmailId);
	number bulkmailRid = getResourceUniqueIdFromGuid(guid);
	BulkMail_send(bulkmailRid);
}		
addJournal(1497860,54,"Comment","Import for " + convertToString(currentvalue) + " is done");