Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

How to identify the first column in a table ?

Hi All,

        I have the following table:

City1LatitudeLongitude
Chak Forty M29.73961871.633704
Chak Forty M32.20204971.755182
Chak Forty M32.01594371.581087
Chak Forty SB31.92638972.826389
Chak Forty30.69666773.446944
Chak Four26.43470368.565174
Chak Four28.013767.705a2
Chak Four28.41941670.181164

I want to show only the first column in the straight or pivot table without hardcoding the City.

I tried using FirstSortedValue function but was not able to get the result.

Can any one help me on this.

Thanks.

6 Replies
rajat2392
Contributor III

Re: How to identify the first column in a table ?

can you please explain a little bit better with some example if possible...

Not applicable

Re: How to identify the first column in a table ?

try to use:

=only({<$FieldNo={1},$Table={'TableName'}>}$Field)

where TableName is name of your table.

regards

Darek

Luminary
Luminary

Re: How to identify the first column in a table ?

Create an Inline table containing all field names you want to use, and the implement the following expression:

$(=FirstSortedValue(FieldNames,Order))

This works for me..

MVP
MVP

Re: How to identify the first column in a table ?

not sure to undestand but if this is your requirement

you can try adding a counter  (see script below) and then use it in expression firstsortedvalue (see lable in image)

1.png

load *, rowno() as row;

load * inline [

City1, Latitude, Longitude

Chak Forty M ,29.739618 ,71.633704

Chak Forty M ,32.202049 ,71.755182

Chak Forty M ,32.015943 ,71.581087

Chak Forty SB ,31.926389 ,72.826389

Chak Forty ,30.696667 ,73.446944

Chak Four ,26.434703 ,68.565174

Chak Four ,28.0137 ,67.70502

Chak Four ,28.419416 ,70.181164

];

or if you want just a column try with a dimension like

=[$(=minstring ({1<[$Table]={TableName},[$FieldNo]={1}>} $Field) )]

Re: How to identify the first column in a table ?

it works when using dollar sign expansion on the previously suggested expression by Darek (credits to him):

=$(=only({<$FieldNo={$(vFieldSelector)},$Table={'tabCities'}>}$Field))

QlikCommunity_Thread_115567_Pic1.JPG.jpg

QlikCommunity_Thread_115567_Pic2.JPG.jpg

QlikCommunity_Thread_115567_Pic3.JPG.jpg

QlikCommunity_Thread_115567_Pic4.JPG.jpg

regards

Marco

anbu1984
Honored Contributor III

Re: How to identify the first column in a table ?