Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
tan123qlik
Partner - Contributor III
Partner - Contributor III

Input block - format for id-name pairs

Hi,

I am trying to create an input block and use a dropdown. Does anyone know how to format an "array of {id-name} pairs" as mentioned in the help?

Labels (1)
1 Solution

Accepted Solutions
Emile_Koslowski
Employee
Employee

Hi @tan123qlik ,

There are 2 approaches here.

1) When the data for the dropdown can vary each run (eg when it comes from a connector)

Build the list by using variable blocks of type List & type Object. The loop block in the example should be replaced by a List block that returns a list of records you want to use to populate the dropdown.

Emile_Koslowski_0-1659961140205.png

Emile_Koslowski_1-1659961227705.png


2) When the data for the dropdown is static

Hard code the list of items as JSON text and use the "Object" formula to transform it into a list.

Emile_Koslowski_2-1659961323527.png

Emile_Koslowski_3-1659961345536.png

I've attached an exported automation that contains both examples.

Kind regards,
Emile

 

View solution in original post

4 Replies
Emile_Koslowski
Employee
Employee

Hi @tan123qlik ,

There are 2 approaches here.

1) When the data for the dropdown can vary each run (eg when it comes from a connector)

Build the list by using variable blocks of type List & type Object. The loop block in the example should be replaced by a List block that returns a list of records you want to use to populate the dropdown.

Emile_Koslowski_0-1659961140205.png

Emile_Koslowski_1-1659961227705.png


2) When the data for the dropdown is static

Hard code the list of items as JSON text and use the "Object" formula to transform it into a list.

Emile_Koslowski_2-1659961323527.png

Emile_Koslowski_3-1659961345536.png

I've attached an exported automation that contains both examples.

Kind regards,
Emile

 

tan123qlik
Partner - Contributor III
Partner - Contributor III
Author

Thanks Emile, that helped. Now I understand the "array of pairs" but my input doesn't show what I expected. I have done

tan123qlik_0-1659966802875.png

 

tan123qlik_1-1659966897362.png

 

But my input looks like this. I was expecting only the names of the apps in the list.

tan123qlik_2-1659966968239.png

 

Emile_Koslowski
Employee
Employee

In the object, the keys must be the literal words "id" and "name". So you'll need to add 2 key/value pairs:

Emile_Koslowski_0-1659967460150.png

Emile

 

tan123qlik
Partner - Contributor III
Partner - Contributor III
Author

Thanks,  I missed that in you first answer.