Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Create variable

Hi,

I want to create dynamic variable which get current selection.

Than I want to use this variable in condition.

For example, if current selection = A, show green color, else gray.

=if(FieldName = My selection), rgb(139,191,31), rgb(124,124,124))

Thanks,

20 Replies
chematos
Specialist II
Specialist II

if(GetCurrentSelection(FieldName ) = A, rgb(139,191,31), rgb(124,124,124))

Anonymous
Not applicable
Author

Hi Jose,

It should be dynamic selection.

It works well with replace bookmarks.

=if(Industries = only({BM03} Industries), rgb(139,191,31), rgb(124,124,124))

When I published it on web server, my bookmarks didn't work.

That's why I need to create dynamic variable.

Thanks,

chematos
Specialist II
Specialist II

well, create an entry box and use New Variable option and use this as the value:

=GetFieldSelections(FieldName)

=if(Industries =$(vVariable), rgb(139,191,31), rgb(124,124,124))

Anonymous
Not applicable
Author

It doesn't work. I attached an example.

chematos
Specialist II
Specialist II

Take a look on this.

Is something like this or I´m missunderstanding?

chematos
Specialist II
Specialist II

I haven´t modified the expressions but you could use the variables

Anonymous
Not applicable
Author

I have problem this expression.

I can't create right condition.

I create variable =GetFieldSelections(FieldName).

Cheers,

chematos
Specialist II
Specialist II

what's the problem exactly?

with this expression?

=if(Industries = $(vIndustry) ,rgb(139,191,31), rgb(124,124,124))

Anonymous
Not applicable
Author

Yes, It doesn't reconize Industries.

I select from Industries =A.

My vIndustry shows Industries:A

And condition doesn't work. I think it should be like

=If( Industry (selected A)=$(vIndustry) (Industries:A), rgb(...)

It should compare apple to apple.

If I select indusry A, the vIndustry should be only A. In this case my expression works.

I hope you understand me.

Thanks,