Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld, June 24-25, 2020. Free virtual event for DI and DA gurus. Register Today
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor III
Contributor III

Dynamic Variable selection

Dear Experts,

I am having some trouble to create a dynamic variable in Qlik.

I am doing as below.

Below is the data.

key, code

1,x

2.y

3,z

Variable : vkey=Max(Key)

which will set 3 as a value.

now how can i set the variable 2 as a default?

however it will still can change dynamically and can not be hard coded.

your response will be highly appreciated!

stalwar1‌ Please need you help!

6 Replies
Highlighted
MVP
MVP

Re: Dynamic Variable selection

Could you explain your business case in a bit more detail? May be with a sample qvw?

Highlighted
Specialist III
Specialist III

Re: Dynamic Variable selection

May be this:

Data:

LOAD * INLINE [

key, code

1,x

2.y

3,z

];

//Fetch the maximum key value

tmpData:

LOAD Max(key) AS maxkey

Resident Data;

LET vkey = Peek('maxkey', 0, 'tmpData');

DROP Table tmpData;

Regards!

Rahul Pawar

Highlighted
Master
Master

Re: Dynamic Variable selection

Hi Amalesh,

Do you want vkey to be no lower than 2?

vkey = rangemax(2, max(Key))

Highlighted

Re: Dynamic Variable selection

try this

Max({1}Key)


or


Max(total Key)

Highlighted
Contributor III
Contributor III

Re: Dynamic Variable selection

Hi Andrew,

Let me test it then I will let you know.

And, thank you guys for your prompt reply.

Regards,

Amalesh

Contributor III
Contributor III

Re: Dynamic Variable selection

Hi Andrew,

The vkey value could be less than 2.

I have used a horizontal list box and there are different value available, in the list box 2 will be defult value while I click other options the value will change accordingly.

I can set max value as a defult.

Thanks

Amalesh