- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Using aliasing
Question on how Qlikview uses aliases in Load statements.
I'm trying to load one table, then create a temporary table from the Resident table, and I'm getting all kinds of errors. Code:
STATESCENARIODATA:
LOAD [Time Period] as Date,
State,
[Scenario Step Name] as ScenarioStep,
Visits,
WeekDay(Date#(Date, 'M/D/YY')) as DayOfTheWeek
FROM
Datasources/ScenarioData_last98days.xlsx
(ooxml, embedded labels, table is Sheet2);
STORE STATESCENARIODATA INTO datasources/STATESCENARIODATA.QVD (QVD);
// Total visits by ScenarioStep and DayOfTheWeek
TEMPORARY1:
LOAD
State,
DayOfTheWeek as TempDayOfTheWeek,
ScenarioStep as TempScenarioStep,
SUM(Visits)
RESIDENT STATESCENARIODATA
GROUP BY TempScenarioStep, TempDayOfTheWeek;
I get an error in (bunch of problems really) with field not found using the Date alias in the WeekDay function. Then another big one, I get a field not found in the group by statement as well... does Qlikview not recognize the aliases until after the load? I'm also getting an "invalid script" or statement or something like that for the entire second table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Try like this
// Total visits by ScenarioStep and DayOfTheWeek
TEMPORARY1:
LOAD
State,
DayOfTheWeek as TempDayOfTheWeek,
ScenarioStep as TempScenarioStep,
SUM(Visits)
RESIDENT STATESCENARIODATA
GROUP BY ScenarioStep, DayOfTheWeek, State;
You also need to include State in the Group By.
Regards,
Jagan.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi You are using wrong fieldname in group by.Please use Dayoftheweek and ScenarioStep in Group by.
Regards
Vijay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
Try This Script
TEMPORARY1:
LOAD
State,
DayOfTheWeek as TempDayOfTheWeek,
ScenarioStep as TempScenarioStep,
SUM(Visits)
RESIDENT STATESCENARIODATA
GROUP BY DayOfTheWeek, ScenarioStep,State;