Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
BARC’s The BI Survey 19 makes it official. BI users love Qlik. GET REPORT
ganderson100
Contributor

Making changes in scipt editor to load field with changes to it

I am currently loading one of my data tables into Qlikview using the following script -

SDUE:
LOAD * FROM

(
txt, codepage is 1252, embedded labels, delimiter is ',', msq);

I would like make a change to one of the fields as it is loaded in -

   Year,'20'&right(Year,2) as AcademicYearShort,

How do I incorporate this in the LOAD script?

Thanks

Greg

4 Replies
Employee
Employee

Re: Making changes in scipt editor to load field with changes to it

SDUE:

LOAD *,

'20'&right(Year,2) as AcademicYearShort;

LOAD * FROM

(
txt, codepage is 1252, embedded labels, delimiter is ',', msq);



or

LOAD

     *,

'20'&right(Year,2) as AcademicYearShort

FROM

(
txt, codepage is 1252, embedded labels, delimiter is ',', msq);

Re: Making changes in scipt editor to load field with changes to it

What is the expected one from this

Right(Year,2) as AcademicYearShort

OR

Year & '20' & Right(Year,2) as AcademicYearShort

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
manucamon
Valued Contributor III

Re: Making changes in scipt editor to load field with changes to it

Hi Greg, try this:

SDUE:
LOAD *,

     Year,'20'&right(Year,2) as AcademicYearShort_new

FROM

(
txt, codepage is 1252, embedded labels, delimiter is ',', msq);


DROP FIELD AcademicYearShort; //IF IT EXISTS

RENAME FIELD AcademicYearShort_new TO AcademicYearShort;


Regards!!

puttemans
Valued Contributor

Re: Making changes in scipt editor to load field with changes to it

Hi Greg,

Can you tell how 'Year' looks like, and what you want as an end result?

If your 'Year' contains the actual year, then I would imagine your Academic year would look like Year-Year+1

In that case, you add


SDUE:
LOAD * ,

          Year&'-'&(Year+1) as AcademicyearShort

FROM


(
txt, codepage is 1252, embedded labels, delimiter is ',', msq);

If you need it like '15-'16 then it would become

'''&right(Year,2)&'-''&(right(Year,2)+1)

Regards,

Johan