Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

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.

3 Replies
jagan
Luminary Alumni
Luminary Alumni

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.

vijay_iitkgp
Partner - Specialist
Partner - Specialist

Hi You are using  wrong fieldname in group by.Please use Dayoftheweek and ScenarioStep in Group by.

Regards

Vijay

perumal_41
Partner - Specialist II
Partner - Specialist II

Hi

Try This Script

TEMPORARY1:

    LOAD

        State,

        DayOfTheWeek as TempDayOfTheWeek,

        ScenarioStep as TempScenarioStep,

        SUM(Visits)

    RESIDENT STATESCENARIODATA

    GROUP BY DayOfTheWeek, ScenarioStep,State;