Вы находитесь на странице: 1из 2

http://www.lindo.com/doc/online_help/lingo15_0/importing_data_from_databases.

htm
he syntax for using @ODBC to import data inside a data section is:
object_list = @ODBC( [ data_source [, table_name
[, column_name_1 [, column_name_2
]]]]);
The object_list is a list, optionally separated by commas, containing model obje
cts (i.e., attributes, sets, or variables) that are to be initialized from the O
DBC data source. Object_list may contain up to one set and/or multiple set attri
butes. All set attributes in object_list must be defined on the same set. If obj
ect_list contains a set, then all attributes in object_list must be defined on t
his set. The data_source argument is the name of the ODBC data source that conta
ins the data table. The table_name argument is the name of the data table within
the data source that contains the data. Finally, the column_name arguments are
the names of the columns, or fields, in the data table table_name to retrieve th
e initialization data from. Set attributes and primitive sets require one column
name each to retrieve their data from. Derived sets require one column name for
each dimension of the set. Thus, a two-dimensional derived set would require tw
o columns of data to initialize its members.
If the data_source argument is omitted, the model's title is used in its place (
see the discussion of the TITLE statement). If table_name is omitted, the name o
f any set in the object_list is used in its place. If there is no set in object_
list, then the name of the set that the attributes in object_list are defined on
is used.
If the column_name arguments are omitted, LINGO will choose default names based
on whether the corresponding object in object_list is a set attribute, a primiti
ve set, or a derived set. When the object to be initialized is a set attribute o
r a primitive set, LINGO will use the name of the object as the default column n
ame. When the object is a derived set, LINGO will generate one default column na
me for each dimension of the derived set, with each name being the same as the p
arent set that the given dimension is derived from. As an example, a two-dimensi
onal set named LINKS derived from the two primitive sets SOURCE and DESTINATION
would default to being initialized from the two columns titled SOURCE and DESTIN
ATION.
Keep in mind that LINGO expects to find set members in text format in the databa
se, while set attributes are expected to be in numeric format.
Some examples of using @ODBC to import data in a model's data section are:
Example 1:
SHIPPING_COST =
@ODBC( 'TRANSPORTATION',
'LINKS','COST');
LINGO initializes the attribute SHIPPING_COST from the column COST contained in
the data table LINKS found in the ODBC data source TRANSPORTATION.
Example 2:
VOLUME, WEIGHT =
@ODBC( 'TRUCKS', 'CAPACITY');
The database column names are omitted, so, assuming VOLUME and WEIGHT are set at
tributes, LINGO defaults to using the attribute names (VOLUME and WEIGHT) as the
database column names. Therefore, LINGO initializes the attributes VOLUME and W
EIGHT from the columns also titled VOLUME

he syntax for using @ODBC to import data inside a data section is:
object_list = @ODBC( [ data_source [, table_name
[, column_name_1 [, column_name_2
]]]]);
The object_list is a list, optionally separated by commas, containing model obje
cts (i.e., attributes, sets, or variables) that are to be initialized from the O
DBC data source. Object_list may contain up to one set and/or multiple set attri
butes. All set attributes in object_list must be defined on the same set. If obj
ect_list contains a set, then all attributes in object_list must be defined on t
his set. The data_source argument is the name of the ODBC data source that conta
ins the data table. The table_name argument is the name of the data table within
the data source that contains the data. Finally, the column_name arguments are
the names of the columns, or fields, in the data table table_name to retrieve th
e initialization data from. Set attributes and primitive sets require one column
name each to retrieve their data from. Derived sets require one column name for
each dimension of the set. Thus, a two-dimensional derived set would require tw
o columns of data to initialize its members.
If the data_source argument is omitted, the model's title is used in its place (
see the discussion of the TITLE statement). If table_name is omitted, the name o
f any set in the object_list is used in its place. If there is no set in object_
list, then the name of the set that the attributes in object_list are defined on
is used.
If the column_name arguments are omitted, LINGO will choose default names based
on whether the corresponding object in object_list is a set attribute, a primiti
ve set, or a derived set. When the object to be initialized is a set attribute o
r a primitive set, LINGO will use the name of the object as the default column n
ame. When the object is a derived set, LINGO will generate one default column na
me for each dimension of the derived set, with each name being the same as the p
arent set that the given dimension is derived from. As an example, a two-dimensi
onal set named LINKS derived from the two primitive sets SOURCE and DESTINATION
would default to being initialized from the two columns titled SOURCE and DESTIN
ATION.
Keep in mind that LINGO expects to find set members in text format in the databa
se, while set attributes are expected to be in numeric format.
Some examples of using @ODBC to import data in a model's data section are:
Example 1:
SHIPPING_COST =
@ODBC( 'TRANSPORTATION',
'LINKS','COST');
LINGO initializes the attribute SHIPPING_COST from the column COST contained in
the data table LINKS found in the ODBC data source TRANSPORTATION.
Example 2:
VOLUME, WEIGHT =
@ODBC( 'TRUCKS', 'CAPACITY');
The database column names are omitted, so, assuming VOLUME and WEIGHT are set at
tributes, LINGO defaults to using the attribute names (VOLUME and WEIGHT) as the
database column names. Therefore, LINGO initializes the attributes VOLUME and W
EIGHT from the columns also titled VOLUME

Вам также может понравиться