Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Highlighted
alexandermllr
Contributor

Qlikview - Change data model

Hello,

I need to change my database model, this is my data right now:

    

IDdeparturearrivalPlace
556716.04.2018 08:30 Place 1
556716.04.2018 08:4216.04.2018 08:42Place 2
556716.04.2018 08:4516.04.2018 08:45Place 3
556716.04.2018 09:1616.04.2018 09:16Place 4
556716.04.2018 09:3816.04.2018 09:38Place 5
556716.04.2018 10:4616.04.2018 09:40Place 6
556716.04.2018 11:0016.04.2018 10:59Place 7
5567 16.04.2018 12:12Place 8

I need a table like this:

     

IDdeparturearrivalPlace_fromPlace_to
556716.04.2018 08:3016.04.2018 08:42Place 1Place 2
556716.04.2018 08:4216.04.2018 08:45Place 2Place 3
556716.04.2018 08:4516.04.2018 09:16Place 3Place 4
556716.04.2018 09:1616.04.2018 09:38Place 4Place 5
556716.04.2018 09:3816.04.2018 09:40Place 5Place 6
556716.04.2018 10:4616.04.2018 10:59Place 6Place 7
556716.04.2018 11:0016.04.2018 12:12Place 7

Place 8

How can I change the data in Qlikview?

Thank you for you help!

1 Solution

Accepted Solutions
daniel_rodrigue
New Contributor III

Re: Qlikview - Change data model

Hello, Alexander Müller!


Is this what you are looking for?

Data:

Load *

Inline

[ID, departure,                  arrival,                    Place

5567, 16.04.2018 08:30,                              , Place 1

5567, 16.04.2018 08:42, 16.04.2018 08:42, Place 2

5567, 16.04.2018 08:45, 16.04.2018 08:45, Place 3

5567, 16.04.2018 09:16, 16.04.2018 09:16, Place 4

5567, 16.04.2018 09:38, 16.04.2018 09:38, Place 5

5567, 16.04.2018 10:46, 16.04.2018 09:40, Place 6

5567, 16.04.2018 11:00, 16.04.2018 10:59, Place 7

5567,                              , 16.04.2018 12:12, Place 8

];

FinalData:

Load ID,

         departure,

         FieldValue('arrival',RowNo() + 1) As arrival,

         Place As Place_From,

         FieldValue('Place',RowNo() + 1) As Place_To

Resident Data

Where Len(departure) > 0;

Drop Table Data;

2 Replies
mwoolf
Honored Contributor II

Re: Qlikview - Change data model

Use Peek or Previous

daniel_rodrigue
New Contributor III

Re: Qlikview - Change data model

Hello, Alexander Müller!


Is this what you are looking for?

Data:

Load *

Inline

[ID, departure,                  arrival,                    Place

5567, 16.04.2018 08:30,                              , Place 1

5567, 16.04.2018 08:42, 16.04.2018 08:42, Place 2

5567, 16.04.2018 08:45, 16.04.2018 08:45, Place 3

5567, 16.04.2018 09:16, 16.04.2018 09:16, Place 4

5567, 16.04.2018 09:38, 16.04.2018 09:38, Place 5

5567, 16.04.2018 10:46, 16.04.2018 09:40, Place 6

5567, 16.04.2018 11:00, 16.04.2018 10:59, Place 7

5567,                              , 16.04.2018 12:12, Place 8

];

FinalData:

Load ID,

         departure,

         FieldValue('arrival',RowNo() + 1) As arrival,

         Place As Place_From,

         FieldValue('Place',RowNo() + 1) As Place_To

Resident Data

Where Len(departure) > 0;

Drop Table Data;