Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Manual addition of a field/dimension

Hi All,

Does anybody know how to manually add a ‘field’ (column) in QlikView which is not there in the load file?

For e.g.

Your load file has only column “CTC” and I would like to add a field “Monthly” (say to find the monthly take home) in the QV script, how do I do it?


PS -

a) I tried to directly add it in the script but it spits out an error.

b) I am fetching the data from a qvd file. Is the issue because of this?



Br,

KG Sriram

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Yes, this has to be there in the script. For age(in days) you can try like:

Load

          Today() - DOB as AgeInDays

From <data source> ;

Note: your DOB field here has to be proper date field.

View solution in original post

8 Replies
tresesco
MVP
MVP

Try something like :

Load

          CTC,

          CTC/12 as Monthly

From <your qvd> ;

If this doesn't help, let know the code you are trying with and error .

Not applicable
Author

@Tresco.. I think that's a good idea..

Let me try that..!!

But wouldn't that come in the expression script pane than in the loading script pane?tresesco

Secondly, Can you tell me how do I find age of students in days as of today.. like Today() - DOB

What should I write in the load script when DOB is a column having 100 dates of 100 students?


Thanks again!

tresesco
MVP
MVP

Yes, this has to be there in the script. For age(in days) you can try like:

Load

          Today() - DOB as AgeInDays

From <data source> ;

Note: your DOB field here has to be proper date field.

MayilVahanan

Hi

Try with Age() function to calculate the age..

Interval(Today() - DOB, 'd') for days.

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

Hi tresesco Mayil Vahanan Ramasamy -

Thanks for your replies.. I tried both your options but in the Load script, I am not able to pick the column name "DOB".. It is not appearing in the drop down...

MayilVahanan

Can you upload the sample file?

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

tresesco Mayil Vahanan Ramasamy - Worked well!! thanks....

One Last question...

I need to bucket these number of days now..

the buckets are say - 0-7, 8-30, 31-60, 61-100, >100

how do i script this?

tresesco
MVP
MVP

Had the buckets been equi-distant, you could have used class(). Otherwise, you have to try with If-Then-Else. Like:

Load

          Today() - DOB as AgeInDays,

          If( Today() - DOB<8, '0-7' , If( Today() - DOB <31, '8-30' , If( .....))) as Buckets

From <data source> ;