Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
jessica_webb
Creator III
Creator III

Dynamic field name based on column heading

Hi,

I'm creating an application which loads data from an excel sheet used by various clients.

All of the columns are predefined with field labels, except the 7th column (column G), which I would like the user to be able to label themselves, and have this pull into QV dynamically.

So for example, in the script it would beL

LOAD

Age,

Gender,

Location,

Column G as Whatever the user named it,

FROM....

And in the application, the field could be used as 'Column G', until it gets renamed by the script.

I hope all this makes sense - is it possible?

1 Solution

Accepted Solutions
sunny_talwar

Check the attached

////Test1

//

//Headers:

//LOAD *

//Where RecNo() = 4;

//LOAD @1 as Header

//FROM

//[266730.xlsx]

//(ooxml, no labels, table is Sheet1, filters(

//Transpose()

//));

//

//Table:

//LOAD *

//FROM

//[266730.xlsx]

//(ooxml, embedded labels, table is Sheet1);

//Test2

Headers:

LOAD *

Where RecNo() = 4;

LOAD @1 as Header

FROM

[266730.xlsx]

(ooxml, no labels, table is Sheet2, filters(

Transpose()

));

Table:

LOAD *

FROM

[266730.xlsx]

(ooxml, embedded labels, table is Sheet2);

Reload the two codes one at a time and see how the front end chart's dimension changes based on the field being loaded

View solution in original post

9 Replies
sunny_talwar

Where will the user give it a name? You will have to explain the setting a little more here

jessica_webb
Creator III
Creator III
Author

Sorry - the heat is making me slow

So the user will complete the spreadsheet and will label the column and choose what values are given.

So for example, the might choose to name Column G as 'Hair colour' and give values of 'red, black, brown, blonde' etc

In my application, I would then want any place where I have used Column G, to become 'Hair colour'

jmvilaplanap
Specialist
Specialist

Hi

You can use LOAD * FROM ...

And all the columns will be loaded whatever the name

jessica_webb
Creator III
Creator III
Author

But how would I use the field within the application?

For example, if I wanted to create a chart with Column G as the dimension...

sunny_talwar

Why don't you just load with * so that the field names that your user have used are the ones that get picked in your app

jessica_webb
Creator III
Creator III
Author

But how would I use the field within the application?

For example, if I wanted to create a chart with Column G as the dimension..

jmvilaplanap
Specialist
Specialist

You can load the names of the columns in another table

If you load the same excel sheet without labels, the names of the columns will be at the first row. Later you must to store the value of the first value of the fourth column in a variable.

This must to work.

sunny_talwar

Check the attached

////Test1

//

//Headers:

//LOAD *

//Where RecNo() = 4;

//LOAD @1 as Header

//FROM

//[266730.xlsx]

//(ooxml, no labels, table is Sheet1, filters(

//Transpose()

//));

//

//Table:

//LOAD *

//FROM

//[266730.xlsx]

//(ooxml, embedded labels, table is Sheet1);

//Test2

Headers:

LOAD *

Where RecNo() = 4;

LOAD @1 as Header

FROM

[266730.xlsx]

(ooxml, no labels, table is Sheet2, filters(

Transpose()

));

Table:

LOAD *

FROM

[266730.xlsx]

(ooxml, embedded labels, table is Sheet2);

Reload the two codes one at a time and see how the front end chart's dimension changes based on the field being loaded

jessica_webb
Creator III
Creator III
Author

You are a genius!


Thank you so, so much!!

I really wasn't sure it could be done