Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

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
Not applicable

Using aliasing

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
Not applicable

Using aliasing

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

Regards

Vijay

perumal_41
Not applicable

Re: Using aliasing

Hi

Try This Script

TEMPORARY1:

    LOAD

        State,

        DayOfTheWeek as TempDayOfTheWeek,

        ScenarioStep as TempScenarioStep,

        SUM(Visits)

    RESIDENT STATESCENARIODATA

    GROUP BY DayOfTheWeek, ScenarioStep,State;