Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to insert a column into table?

Hi all,

I've loaded multiple fields from an Excel-file with information about several cities into a table 'cities'.

Something like this:

Cities:

LOAD

Cities,

Residents,

Income

FROM [file1.xlsx]

I have another Excel-file with two fields: 'States' and 'Cities'.

In order to link this file to the table, I used a Left Join:

LEFT JOIN(Cities)

LOAD

Cities,

States

FROM [file2.xlsx]

This works well. The result is a table with columns 'Cities', 'Residents', 'Income', 'States'.

However, I want the same table but in another order, like: 'Cities', 'States', 'Residents', 'Income'.

Does anyone know how to link those files and get the field 'States' as the second column of the table?

Thanks in advance!


15 Replies
Not applicable
Author

I know this, but my problem is that I want to make a crosstable after I added the column 'States' to the table. To make a crosstable I need to set the Qualifier Fields, which are the first columns of the table.

Anonymous
Not applicable
Author

Hi Mark

Is there any reason why you are looking for particular order because it doesnt matter for Qlikview

If you want to storing the table then you can use like wise

store table Cities ,states,Resident,Income rsident Citties into test.qvd(qvd); or test.csv(csv);

Regards

Harsha

Not applicable
Author

Yes, the reason is that  I want to make a crosstable after I added the column 'States' to the table. To make a crosstable I need to set the Qualifier Fields, which are the first columns of the table.

Maybe I should just store the table, reorder it, load it again as a crosstable. But I hope that there is a way to do it in one script

Not applicable
Author

Within the crosstable, just reorder the load of the fields there?

Crosstable(xxx,YYY,3)

Load

States,

Cities,

Residents,

Income

Resident xxxx;

The crosstable will use the order from the Load

Hope that helps

Joe

Not applicable
Author

Thanks Joe! I used this code before:

Crosstable(xxx,YYY,3)

LOAD

*

Resident xxxx

However, my code is much more compact (because in my real dataset I have lots of fields), if I want to have the table in this specific order I have to do it like you said.


Not applicable
Author

Yea with that code the order is set as you say, glad to be of help though