Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to create QV tables in scripts

Hello,

What's the QV script syntax to produce the following tables?  See attached screen.  This is what

I'm looking for.  Given the data in rows 1 thru 5, how do you write the QV code to produce two additional

tables (rows 7-9 and rows 11-15)?

sample_data.jpg

I'm sure this isn't that difficult for some of the more experienced QV developers. 

I appreciate your help.

17 Replies
Anonymous
Not applicable
Author

The ROWID is not being displayed when I ran it.

maxgro
MVP
MVP

you can use autonumber to make unique ROWID for each REGION

SOURCE:

LOAD * INLINE [ 

REGION , STATE 

EAST, NY 

EAST, MA 

WEST, CA 

WEST, WA 

]; 

OUTPUT1:

load AutoNumber(REGION) as ROWID, REGION Resident SOURCE;

Left Join (SOURCE) load * Resident OUTPUT1;   

1.png

Anonymous
Not applicable
Author

I see you've a screenshot showing the output I wanted.  When I looked the model, I see this and none of the table

gives me the ROWID, REGION and STATE columns.  Is this what I'm expecting to see?

result_2.jpg

maxgro
MVP
MVP

do you really need 3 tables? why?

or may be you can stay with 1?

SOURCE:

LOAD * INLINE [ 

REGION , STATE 

EAST, NY 

EAST, MA 

WEST, CA 

WEST, WA 

]; 

Left Join (SOURCE) load Distinct REGION, AutoNumber(REGION) as ROWID Resident SOURCE;   

Anonymous
Not applicable
Author

MG,

This is perfect !  That's exactly what I was looking for.

Thanks.

Anonymous
Not applicable
Author

MG,

I'm just coming back to what you had posted earlier which is this

SOURCE:

LOAD * INLINE [

REGION , STATE

EAST, NY

EAST, MA

WEST, CA

WEST, WA

];

OUTPUT1:

load AutoNumber(REGION) as ROWID,

  REGION

Resident SOURCE;

Left Join (SOURCE) load * Resident OUTPUT1;  

What would I need to do so I can see the last resultset in the data diagram?  I guess it would be the result of running that very last statement in above which the LEFT JOIN.  I tried to alias it with a table name right before it and I still didn't see it in the diagram.  I know you already provided a perfect solution to me but I wanted to learn how to get this

working as well.

maxgro
MVP
MVP

Not sure to understand your last question

In the table viewer (ctrl + t) you see the qlik data model.

1.png

You don't need a table for every different chart you want to show.

You don't need all the fields of your chart in the same table.

You can build a chart using all the fields in the data model.

If you want this, just add a tablebox object with the 3 fields

1.png