Make sure your qvd file really has a field with the exact name HRMS_AS_OF_DATE. Note that Qlikview is case sensitive with regards to field names. That means HRMS_AS_OF_DATE, hrms_as_of_date and Hrms_As_Of_Date are three different fields.
Thanks for the reply. Maybe it'll help if I include the whole script....
Basically, I'm trying to do an incremental load. The first run-through works and creates a qualified field name of HRMS_EMP.HRMS_AS_OF_DATE. Once the QVD is created, on the next run I want to load the deltas into the table HRMS_EMP table and store them in the QVD. The IF statement determines the start date of the loop based on the last HRMS_AS_OF_DATE from the data loaded from the QVD. With the script as-is below, I think I end up with 2 sets of fields in the table - one set qualified as HRMS_EMP.xxx and the other as EmpDataTemp.xxx, (I truncated the list of fields, but you get the idea...)
I have to loop through the SQL by date because I'm using a function to build a slowly changing dimensions table, and the function only gives data as per a certain date. I think maybe it has something to do with my table names and the loop and the fact that I'm not qualifying the field names, but if I qualify the field names in the loop I end up with multiple temp tables (EmpDataTemp-1. EmpDataTemp-2, etc...
So, maybe I'm going about this wrong? TIA for any pointers.
vProcDate=vStartDate // Use Default Start Date from Config. Could change below if QVD exists.
// Check to see if EmpQVD Exists and load if it does
LET vEmpQVDExists = isnull(FileTime(vEmpQVD)); // if qvd exists then 0 else -1
IF $(vEmpQVDExists)=0 THEN
// Load Contents of Current Employee QVD into Temp Table
UNQUALIFY EMPLOYEE_ID, MGR_ID1;
LOAD * FROM $(vEmpQVD) (qvd);
// Update the Start Date based on the last update in the QVD
// Get last HRMS_UPDATE_DATE from HRMS+. Not sure yet if I'm going to use this.
Load LAST_UPDATE as MaxValue;
SQL SELECT MAX(HRMS_AS_OF_DATE) as LAST_UPDATE FROM fn_getEmpCoreAttributes(getdate(), default, default);
Drop Table Temp;
// Get last HRMS_UPDATE_DATE from HRMS_EMP
Load Max(EmpDataTemp.HRMS_AS_OF_DATE) AS MaxValue RESIDENT EmpDataTemp;
Drop Table Temp;
//Set the Process Start Date to the last day in the QVD
I think I got it working. I had to stop using the EmpDataTemp table name and just use HRMS_EMP everywhere and trust Qlik to concatenate the data properly. I also had to stop QUALIFYING all but the final load from the QVD, which seemed to fix the Table-1, Table-2, etc... issue.