Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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
Clever_Anjos
Employee
Employee

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);

Anil_Babu_Samineni

What is the expected one from this

Right(Year,2) as AcademicYearShort

OR

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

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anonymous
Not applicable
Author

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
Specialist
Specialist

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