Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
In my Qlik Sense app, I am FIRST loading a list campaign members from one campaign in salesforce.
I want to load ONLY lead/contact information from people who are a part of that campaign.
I would imagine the syntax to be something like below, but I know this is not correct:
LOAD
@1,
@2,
@3;
SELECT * FROM Lead
WHERE Id IN (SELECT DISTINCT Id FROM ResidentTable)
Any help is appreciated!
Figured it out. I had to qualify the field in the PEEK
LET vListContact = Peek('ListContact.ListContact');
So, is it working now?
Not yet. Some the values stored in the variable is throwing an error.
Oh really? What error message do you get?
INVALID_QUERY_FILTER_OPERATOR: LID__LinkedIn_Member_Token__c FROM Lead WHERE Id IN ('\'\',\'00Q1400001QVqbXEAT\' ^ ERROR at Row:1:Column:7304 invalid ID field:
What is ID field here? Why is that field invalid?
Just understanding simple SQL ... it might be an issue where the last ',' in the IN statement is possibly causing and issue, but I am not sure. If there are suggestions in how I can zoom in to the exact place of error that would be great. I might be able to figure it out myself if I can drill deeper ...
Where are you seeing the last ','? Just look at the error message doesn't really show me the complete picture... may be share your script up until where you run this SQL
When we create the variables below we CONCAT ',' to every Id ... But for the IN statement to work the last ID must NOT have a ','
i.e WHERE Id IN ('1','2','3')
ListLead:
LOAD Concat(DISTINCT Chr(39) & LeadId & Chr(39), ',') as ListLead,
;
SELECT *
FROM CampaignMember
WHERE CampaignId = '7011O0000021IGvQAM';
LET vListLead = Peek('ListLead.ListLead');
TRACE $(vListLead);
ListContact:
LOAD Concat(DISTINCT Chr(39) & ContactId & Chr(39), ',') as ListContact,
;
SELECT *
FROM CampaignMember
WHERE CampaignId = '7011O0000021IGvQAM';
LET vListContact = Peek('ListContact.ListContact');
TRACE $(vListContact);
Below is where I want to use the variable to only select IDs identified in a specific campaign:
Who:
UNQUALIFY *;
LOAD Id as WhoId,
Id as WhoId2,
Title as WhoTitle,
Email as WhoEmail,
LeanData__Reporting_Matched_Account__c as AccountId,
Company;
SELECT *
FROM Lead
WHERE Id IN
('$(vListLead)');
Concatenate(Who)Add
LOAD Id as WhoId,
Id as WhoId2,
AccountId,
Title as WhoTitle,
Email as WhoEmail;
SELECT *
FROM Contact
WHERE Id IN
('$(vListContact)');
EXIT SCRIPT;
Something is wrong with the way ID is being concatenated .. Below is an excerpt of how the IDs look in the statement
SELECT *
FROM Lead
WHERE Id IN
(''''',''00Q1400001QVqbXEAT'',''00Q1400001SItOSEA1'',''00Q1400001SJYKkEAP'',''00Q1400001XQSBZEA5'',''00Q1400001XQSBbEAP'',''00Q1400001XQSBeEAP