Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
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
MVP
MVP

Re: Manual addition of a field/dimension

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.

8 Replies
MVP
MVP

Re: Manual addition of a field/dimension

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

Re: Manual addition of a field/dimension

@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!

MVP
MVP

Re: Manual addition of a field/dimension

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.

Re: Manual addition of a field/dimension

Hi

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

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

Not applicable

Re: Manual addition of a field/dimension

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

Re: Manual addition of a field/dimension

Can you upload the sample file?

Not applicable

Re: Manual addition of a field/dimension

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?

MVP
MVP

Re: Manual addition of a field/dimension

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

Community Browser