Forum Discussion

FICO's avatar
FICO
Community Manager
12 years ago

Key-value lookup, one-to-one mapping

Key-value lookup, one-to-one mapping

Hello,

how do I lookup a value based on a key selected in different field? I have:

- list provider in value holder where only one value can be selected

- another value holder where value should be dynamically selected based on selection in first list - there is one to one mapping.

I do not want to use association provider because I have many key/value pairs and does not make sense to create one provider for every pair. I also cannot use database provider. Any other options?

Tomas

2 Replies

  • FICO's avatar
    FICO
    Community Manager

    For the second value holder you can make it a provider of Generic type. You'd then write your own custom provider class using the provider API. In the class you'd have a parameter which would represent the first provider. Then on the new provider you'd tell it to pass value holder 1 into this generic provider class as a parameter.

    From your generic class you can use the parameter to determin which values to return.

  • FICO's avatar
    FICO
    Community Manager

    Thank you Grant. I understand your answer conceptually, but it seems I lack some skills to do it. Will update once I learn how to write custom provider.

    Regards,

    Tomas