Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
Expand all | Collapse all

Reading single values from database

  • 1.  Reading single values from database

    Posted 05/22/09 05:36 PM

    Originally posted by: SystemAdmin


    [Gerriet said:]

    Hello!

    is there a way to read a single value from a database? E.g. something like

    string SomeValue = ...; in the model

    and

    SomeValue from DBRead(db,"SELECT TOP 1 CStr(SomeValueCol) FROM ConfigTable;");

    in the data file.

    The code above does not work, because database initialization is only for sets and arrays. But is there a trick?

    Regards
      Gerriet
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Reading single values from database

    Posted 05/26/09 04:41 PM

    Originally posted by: SystemAdmin


    [afleischer said:]

    Hi,

    you could replace the element by a singleton and write


    {string} SomeValue = ...;


    in the .mod and


    SomeValue from DBRead(db,"SELECT TOP 1 CStr(SomeValueCol) FROM ConfigTable;");


    in your .dat

    Then in the .mod you can compute the value out of the singleton using first(Somevalue)

    Alex


    #DecisionOptimization
    #OPLusingCPLEXOptimizer