I am having an issue creating an alias name while looping in qlik sense. Below are my 2 code versions both not successful, nothing wrong with the joins or resident tables.
Version 1
// Define an array of phone types
SET phoneTypes = 'CELLPHONE', 'WORKPHONE';
// Loop through each phone type and perform the join for the first set of fields
FOR each phoneType IN phoneTypes
FOR i = 0 TO 2
LET j = i + 1;
LEFT JOIN (table1)
LOAD DISTINCT
FIELDA as $(phoneType)_FIELDA$(j),
Date(Date(CREATEDDATE)-$(i)) as CREATEDDATE,
$(phoneType) as PHONENUMBER
Resident table2;
NEXT
NEXT
Version 2
// Define an array of phone types
SET phoneTypes = 'CELLPHONE', 'WORKPHONE';
// Loop through each phone type and perform the join for the first set of fields
FOR each phoneType IN phoneTypes
FOR i = 0 TO 2
LET j = i + 1;
LEFT JOIN (table1)
LOAD DISTINCT
FIELDA as $(phoneType)&'_FIELDA'&$(j),
Date(Date(CREATEDDATE)-$(i)) as CREATEDDATE,
$(phoneType) as PHONENUMBER
Resident table2;
NEXT
NEXT
