Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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
tresesco
MVP
MVP

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

rahulpawarb
Specialist III
Specialist III

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

effinty2112
Master
Master

Hi Amalesh,

Do you want vkey to be no lower than 2?

vkey = rangemax(2, max(Key))

Kushal_Chawda

try this

Max({1}Key)


or


Max(total Key)

Anonymous
Not applicable
Author

Hi Andrew,

Let me test it then I will let you know.

And, thank you guys for your prompt reply.

Regards,

Amalesh

Anonymous
Not applicable
Author

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