Initializing help system before first use

Reading several arrays from a single table

If two or more data arrays have the same index sets, then their values may be defined in a single spreadsheet range/database table, such as the following table where the first two columns hold the indices and the last two colums the data entries for two arrays:

Products Mach Cost Duration
prod1 1 1.2 3
prod1 3 2.4 2
prod2 3 3 1
prod2 2   2
prod4 1 4 5
prod4 4 3.2 2
prod3 3 5.7 2
prod3 4 2.9 8
prod3 1 3  

Notice that in this table not all entries are defined for every array.

The following Mosel model multicol.mos reads the data from the range ProdData into two array, COST and DUR. For every array only those entries that are specified in the input data will actually be defined:

model "Multiple data columns"
 uses "mmodbc"

 declarations
  PRODUCTS: set of string
  MACH: range
  COST: dynamic array(PRODUCTS,MACH) of real
  DUR: dynamic array(PRODUCTS,MACH) of integer
 end-declarations

 initializations from "mmodbc.odbc:multicol.sqlite"
  [COST,DUR] as 'ProdData'
 end-initializations

 writeln(COST); writeln(DUR)

end-model 

The SQL version of this model is as follows:

 SQLconnect('multicol.sqlite')
 setparam("SQLverbose",true)
 SQLexecute("select * from ProdData ", [COST,DUR])
 SQLdisconnect 

If we wish to read data from a different database, also defining the table ProdData, we again simply need to adapt the filename or the connection string to the database name.

To use the excel driver with a data range definition that includes the header line the option skiph needs to be employed.

 initializations from "mmsheet.excel:multicol.xls"
  [COST,DUR] as 'skiph;ProdData'
 end-initializations

© 2001-2019 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.