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.
kumarkp412
Contributor II

How to replace the one date by another date and a number also?

Hi  friends,

i am  having the data as

id  name date1       date2

0    A      1/1/2000  1/3/2010

1   A       2/1/2000  2/4/2010

2  B       3/1/2000     2/5/2010

3   c       3/1/2000     2/6/2010

4   c       4/1/2000     2/7/2010

In the above table , name  'A' as two rows as id=0,id=1 then in this i want to take the id = '1' and i also want to take minimum date of these two name

It should be like these:

id name date1 date2

1 A      1/1/2000   2/4/2010

2  B       3/1/2000     2/5/2010

3   c       3/1/2000     2/6/2010

4   c       4/1/2000     2/7/2010

can any help me,

I tried many thing but i am not both things , but only i am getting only one of these.

Thanks in advance

Kumar

8 Replies
qlikrajan
Contributor III

Re: How to replace the one date by another date and a number also?

just a question. Do you want to take minimum date only in case of first two ids 0 and 1 not in ids 3 and 4 or any other ids?

kumarkp412
Contributor II

Re: How to replace the one date by another date and a number also?

Hi Rajan,

yes , i want  to take the minimum date only if  ids 0 and 1

Thanks

kumar

qlikrajan
Contributor III

Re: How to replace the one date by another date and a number also?

attached is the solution, let me know if you want this or need any change.

qlikrajan
Contributor III

Re: How to replace the one date by another date and a number also?

I have manipulated data in script, so check script.

kumarkp412
Contributor II

Re: How to replace the one date by another date and a number also?

Hi Rajan,

Thanks for given this , but in the script you are taking min date based on name .

But i want to take the minimum date based on ids 0 and 1  by same name.

1)If the same name having the other id like name(A) id(3) then it should take the minimum date from id s 0 and 1 and it should not take date form id 3 even if it is having the same name.

2)If the ids is not having the 0 then it should consider each row as different record even if it is having the same name,it should take minimum date of that date only .

3)if the ids is 0 and name is different then it should consider as each row as different record, it should take minimum date of that date only

Thanks

Kumar

qlikrajan
Contributor III

Re: How to replace the one date by another date and a number also?

Hey Praveen:

I worked on your query, it took a little time as I had some other work. Please find the updated qvw attached. Go over script part, I have done data manipulation there to meet your requirements.

First I have separated table in two parts-one consisting id (0,1) and other consisting (rest of the ids). I did operation in first part and then concatenated it with the second part, as you don't want any change in rest of the ids.

Let me know if you get issue with script, I can explain. I am pretty sure that script could be made more precise.

Have a good one!

kumarkp412
Contributor II

Re: How to replace the one date by another date and a number also?

Thank you  Rajan,

Thanks

Kumar

qlikrajan
Contributor III

Re: How to replace the one date by another date and a number also?

If your query has been answered then close this thread by marking as answered.

Community Browser