Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Add a column in script

I'm a beginner in Qlikview and have a simple question. I would like to add a column in my script to one of the files that I have inserted. I would like to add the column 'Year' based on the information I have in the column [Business Day Start Date] (the information in this column is YYYY-MM-DD), how do I do this in the script? The reason I would like to add this column is that I would like it to be the key link between two documents.

LOAD
@1 as [File Row Number],
@2 as [Business Day Start Date],
@3 as [Retailer Number],
@4 as [Machine Position]
FROM
[data\Machine level\file1*.txt]
(
txt, codepage is 1252, no labels, delimiter is '|', msq);

2 Replies
Anonymous
Not applicable
Author

use a preceding load

load *,

year( [Business Day Start Date]) as Year

;

LOAD
@1 as [File Row Number],
@2 as [Business Day Start Date],
@3 as [Retailer Number],
@4 as [Machine Position]
FROM
[data\Machine level\file1*.txt]
(
txt, codepage is 1252, no labels, delimiter is '|', msq);

maybe you Need to Format the dateformat if not recognized as date

sunny_talwar

Try this:

LOAD *,

          Year([Business Day Start Date]) as Year;

LOAD

@1 as [File Row Number],
Date#(@2, 'YYYY-MM-DD') as [Business Day Start Date],

@3 as [Retailer Number],
@4 as [Machine Position], 
FROM
[data\Machine level\file1*.txt]
(txt, codepage is 1252, no labels, delimiter is '|', msq
);