Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

loveqliksense
New Contributor III

Fieldname Function

Hi all,

I have a table location and I want to find the fieldname as well as field number from the table. How can I do it?

I know the syntax of Fieldname function but don't know  how to and where to place this syntax in the script to make it work.

FieldName(1,'Table1')

Thanks in advance

12 Replies
zebhashmi
Valued Contributor

Re: Fieldname Function

you can pass the result to some field like

ID & FieldName(1,'Table1') as ID2,

loveqliksense
New Contributor III

Re: Fieldname Function

I tried let a= NoOfFields(location) in script.

But when still I am not able to see how many fields are there in this table.

loveqliksense
New Contributor III

Re: Fieldname Function

I can add this anywhere in the script coz it throwing error is I add this as it is.

zebhashmi
Valued Contributor

Re: Fieldname Function

test:

LOAD

    ID,

    MapSq as MapSq.map

FROM [lib://AttachedFiles/Temp.xlsx]

(ooxml, embedded labels, table is Sheet1);

Tag field MapSq.map with $geomultipolygon;


New:

Load

ID & FieldName(2,'test')as ID1

FROM [lib://AttachedFiles/Temp.xlsx]

(ooxml, embedded labels, table is Sheet1);

zebhashmi
Valued Contributor

Re: Fieldname Function

your table has to be in memory.

loveqliksense
New Contributor III

Re: Fieldname Function

So my table name 'Location ' is already used in the script. In this scenario how should I add it in the script.

select * from Location;

zebhashmi
Valued Contributor

Re: Fieldname Function

New:

Load

FieldName(2,'test')as ID1

FROM [lib://AttachedFiles/Temp.xlsx]

(ooxml, embedded labels, table is Sheet1);

loveqliksense
New Contributor III

Re: Fieldname Function

But I do not have this excel sheet.

FROM [lib://AttachedFiles/Temp.xlsx]

(ooxml, embedded labels, table is Sheet1);

loveqliksense
New Contributor III

Re: Fieldname Function

I did

New:

Load

Fieldname(2,'Location') as ID1

Resident Locationlevels;

Community Browser