Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

How to use file.json in drop down datasource to populate dynamic value ?

Avatar

Avatar
Validate 1
Level 2
hpathan
Level 2

Like

1 like

Total Posts

24 posts

Correct Reply

2 solutions
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 2
hpathan
Level 2

Like

1 like

Total Posts

24 posts

Correct Reply

2 solutions
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile
hpathan
Level 2

22-02-2018

I am using AEM 6.3 SP1 and creating a touch ui dialog using coral ui 3.

Dialog has drop-down. I want to populate the drop down options from resource e.g. file.json. where options are stored as a string json key-value pare.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,406 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,406 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

22-02-2018

To do this - you need to use a WCMUSEPOJO class and read the JSON file using Java app logic.

Then you need to set a DataSource object and put the JSON values into this Object. That way - the DataSource object is populated with JSON data and will populate a drop-down (Select field).

See this article to learn how to use a DataSource Object to populate a Select field in a Touch UI dialog.

Adobe Experience Manager Help | Using an WCMUsePojo class to populate an Experience Manager Touch UI...

This is how you can dynamically populate a Select field or use other data types like XML or JSON. Parse the JSON and populate the DataSource object - which will then be displayed in the Select field.

As shown in the article - you can use a Map object to define the values. After you parse the values from the JSON data, place them into the MAP.

final Map<String, String> countries = new LinkedHashMap<String, String>();

countries.put("in", "India");

countries.put("us", "United States");

countries.put("aus", "Australia");

countries.put("pak", "Pakistan");

countries.put("sri", "Srilanka");

Hope this helps....

Answers (1)

Answers (1)

Avatar

Avatar
Validate 1
Level 2
hpathan
Level 2

Like

1 like

Total Posts

24 posts

Correct Reply

2 solutions
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 2
hpathan
Level 2

Like

1 like

Total Posts

24 posts

Correct Reply

2 solutions
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile
hpathan
Level 2

27-02-2018

Thanks for sharing approach !