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

Recommendations Designs - velocity - map

Avatar

Avatar
Validate 1
Level 2
Jerome1978
Level 2

Likes

14 likes

Total Posts

21 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile

Avatar
Validate 1
Level 2
Jerome1978
Level 2

Likes

14 likes

Total Posts

21 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile
Jerome1978
Level 2

08-02-2019

Hi,

I am trying to setup a Map array for design, I am able to set the map array but I can access it's value

Apache Velocity Engine - User Guide

#set( $monkey.Map = {"banana" : "good", "roast beef" : "bad"})

$monkey.Map.get("banana") Doesn't work

Is map included?

rgds,

jerome

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Contributor
Level 7
Eric_Vidana
Level 7

Likes

157 likes

Total Posts

151 posts

Correct Reply

37 solutions
Top badges earned
Contributor
Shape 1
Give Back 5
Give Back 3
Give Back 25
View profile

Avatar
Contributor
Level 7
Eric_Vidana
Level 7

Likes

157 likes

Total Posts

151 posts

Correct Reply

37 solutions
Top badges earned
Contributor
Shape 1
Give Back 5
Give Back 3
Give Back 25
View profile
Eric_Vidana
Level 7

12-02-2019

It seems that using the Map is where things go wrong.

$translateReadmore.en

$translateReadmore.fr

$translateReadmore.de

Those should work based on the example. Tried your use case as well:

#set( $translateReadmore = {"en" : "Read more", "fr" : "lire la suite", "de" : "Mehr darüber"})

#set( $language = "en" )

{

    "entityId" : "$entity.id",

    "test" : "$translateReadmore[$language]"

}

test comes through fine as Read more

Answers (3)

Answers (3)

Avatar

Avatar
Validate 1
Level 2
Jerome1978
Level 2

Likes

14 likes

Total Posts

21 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile

Avatar
Validate 1
Level 2
Jerome1978
Level 2

Likes

14 likes

Total Posts

21 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile
Jerome1978
Level 2

12-02-2019

Yes it works, many thanks Eric !!

Avatar

Avatar
Validate 1
Level 2
Jerome1978
Level 2

Likes

14 likes

Total Posts

21 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile

Avatar
Validate 1
Level 2
Jerome1978
Level 2

Likes

14 likes

Total Posts

21 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile
Jerome1978
Level 2

12-02-2019

Hi Eric,

Sorry I don't understand your answer.

Let me give you an example of what I want to do - If I want to translate a Design

#set( $translateReadmore.Map = {"en" : "Read more", "fr" : "lire la suite", "de" : "Mehr darüber"})

So I could use in the Design ($language determined based on Metadata)

$translateReadmore.Map.get($language)

Rgds,

Jerome

Avatar

Avatar
Contributor
Level 7
Eric_Vidana
Level 7

Likes

157 likes

Total Posts

151 posts

Correct Reply

37 solutions
Top badges earned
Contributor
Shape 1
Give Back 5
Give Back 3
Give Back 25
View profile

Avatar
Contributor
Level 7
Eric_Vidana
Level 7

Likes

157 likes

Total Posts

151 posts

Correct Reply

37 solutions
Top badges earned
Contributor
Shape 1
Give Back 5
Give Back 3
Give Back 25
View profile
Eric_Vidana
Level 7

11-02-2019

So it is not exactly what you are asking ... however this works for me.

#set( $monkey = {"banana" : "good", "roast beef" : "bad"})

{

    "entityId" : "$entity.id",

    "test" : "$monkey.banana"

}

Response

{

    "thirdPartyId": "ldksjflaksdjfldjlkf",

    "edgeHost": "mboxedge19283048309849803487.tt.omtrdc.net",

    "content": "{\n    \"entityId\" : \"top-secret-product\",\n    \"test\" : \"good\"\n}",

    "sessionId": "abc123554"

}

Seems like it does not need to be specified as a map.