Forum Discussion

FICO's avatar
FICO
Community Manager
13 years ago

Creating a db based key-value provider

Creating a db based key-value provider

Hi,

I'm using Blaze Advisor 6.8. For a decision table I would like to create a provider which allows users to select from a drop down list.

I managed to create such a provider using the Generic provider type based on the UserDefinedDisplayValueProvider class. However, here I have to enter the key/value pairs manually. Other provider types like the Value List and Database provider don't allow me to create key/ value pairs, only a simple array (value list without keys). What I would prefer is to have e.g. a database provider which allows me to select the key value pairs from a database. The result would be for example:

Key/Value

m/Male

f/female

However, I don't see how I can tell the database provider to use the key for generating the SRL for the decision table and displaying the value in the decision table. Something similar to what the Generic provider type based on the class UserDefinedDisplayValueProvider allows me to do. Is this possible? If so how?

Another question for the database provider would be where I can maintain connection parameters and pass them to the provider using a variable. I don't want to hard code the connection parameters into the provider, as they differ on DEV, QA, PRODUCTION, etc.

Appreciate you support!

Best regards,

Mathias

2 Replies

  • FICO's avatar
    FICO
    Community Manager

    one solution would be to use the generic provider to call a class that loads the provider from the DB. then you could keep all your connections in a environement variable.

    I believe blaze has access to system variables as well, not sure if you can add custom ones here or not though.

  • FICO's avatar
    FICO
    Community Manager

    Thanks for the reply.

    I was hoping that something simple like a key/value based provider filled from a database is something straight forward for which you don't have to start coding. But obviously that's not the case then.

    Thanks.