Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Leo2
Contributor III
Contributor III

Conditional Sequence of lines in the table (Chess Game Data)

Hello everybody!

I'm working on some script which should transform PGN files (chess game data) to some nice table to be able to work with the data. The source file is the text file containing fields like:

Source:

[Name - John]

[Date - 2018.08.12]

[Site - htt...]

etc...

Initially transformed to:

Transformed1:

Dimension, Data

Dim1, Data1

Dim2, Data2

Dim3, Data3

...

Then to:

Transformed2:

game #, Dim1, Dim2, Dim3...

1, Data1, Data2, Data3...

And this sequence of the same fields continues for every single game (so we have a long list). I was rather happy to write a script to transform those rows to columns (dimensions) assuming that there's 18 dimensions present for every game, but... As I realized lately not all the games have 18 dimensions; some have 16. But my script was written for "18-dimensional matrix" and obviously at some point data got shifted...

The question is how to arrange the data on that "18-dimensional matrix". How to add empty lines for the missing dimensions (see Transformed1)? Or in general how would you solve this task? I'm not providing the actual data at the moment; just would like to hear some suggestions in theory. But could post the code later if needed. Many thanks in advance.

P. S. I'm new to QlikView.

Labels (2)
1 Reply
Sergey_Shuklin
Specialist
Specialist

Hello!

It would be useful to get some data or output instance, but I'll try to guess.

Maybe this simple decision would help you: try to use Pivot Table chart.

I've loaded 5 games (donno how your games get loaded - one by one the same as mine or it's one table).

After that create a Pivot Table and drag one dimension to columns and one to rows.

You should get something like this:

pivot_chess_pic1.png

So there were less than 18 dimensions just null and table have a fixed size.

If I misunderstood your request - please tell about it.