Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get data from Array #26

Closed
javierpe opened this issue Dec 20, 2017 · 6 comments
Closed

How to get data from Array #26

javierpe opened this issue Dec 20, 2017 · 6 comments

Comments

@javierpe
Copy link

javierpe commented Dec 20, 2017

Example: contact.put("groups", Arrays.asList("Testers", "Developers"));
I getting an error: context.resolveVariable("contact.groups.something");

Help me please!

@rowanseymour
Copy link
Contributor

@FranciscoJavierPRamos could you provide some more information about what you're trying to do.

@javierpe
Copy link
Author

I have this code:
`

    Map<String, Object> contact = new HashMap<>();
    contact.put("*", "Bob");
    contact.put("name", "Bob");
    contact.put("age", 33);
    contact.put("join_date_1", "28-08-2015 13:06");
    contact.put("isnull", null);
    contact.put("isbool", true);
    contact.put("isfloat", 1.5f);
    contact.put("islong", 9223372036854775807L);
    contact.put("isdict", dict);

    Map<String, Object> address1 = new HashMap<>();
    address1.put("country", "México");
    address1.put("city", "Puebla");

    Map<String, Object> address2 = new HashMap<>();
    address2.put("country", "España");
    address2.put("city", "Barcelona");

    contact.put("address", Arrays.asList(address1, address2));

`

Im trying to get data some like this: contact.address[0].country

@rowanseymour
Copy link
Contributor

Ah ok. This expressions library doesn't support array indexing. However we're in the process of developing a new engine which will: https://github.com/nyaruka/goflow

@javierpe
Copy link
Author

Thank you!

@rowanseymour
Copy link
Contributor

Sorry @nicpottier just reminded me you should be able to do contact.address.0.country!

In the new goflow engine you'll be able to write [0]

@javierpe
Copy link
Author

contact.address.0.country does not work for me :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants