Initializing help system before first use

ins~getarray

Purpose
Create an ins~entityfetch record for fetching the content of an array into a Mosel variable.
Synopsis
function getarray(entity:text, dst:any):ins~entityfetch
function getarray(entity:text, filters:list of list of any, dst:any):ins~entityfetch
Arguments
entity 
The name of the entity to fetch
filters 
Optionally, a list of which values to return for each index set
dst 
A reference to a variable into which to store the array entity content
Return value
A value that can be passed to ins~getscendata to read the array into the given variable.
Example
declarations
  SCENARIO_ID='2926e9a1-9568-4116-84ed-2e75190bc651'
  Regions: set of string
  Months: set of integer
  Prices: dynamic array(Regions, Months) of real
end-declarations
ins~getscendata(SCENARIO_ID, [ ins~getarray('Prices', Prices) ] )
if ins~haserror then
  writeln_('Error: ',ins~getlasterror)
else
  forall (region in Regions, month in Months |
      exists(Prices(region,month))) do
    writeln('Price in ', region, ' for month #', month, ': ',
        Prices(region,month))
  end-do
end-if
Example of fetching all values from an array entity.
declarations
  SCENARIO_ID='2926e9a1-9568-4116-84ed-2e75190bc651'
  regionsfilter: list of any
  monthsfilter: list of any
  Regions: set of string
  Months: set of integer
  Prices: dynamic array(Regions, Months) of real
end-declarations
regionsfilter := ['UK']   ! Fetch only prices for the UK
monthsfilter := [1, 2, 3] ! Fetch only prices for the first 3 months
ins~getscendata(SCENARIO_ID, [ ins~getarray('Prices',
    [regionsfilter, monthsfilter], Prices) ] )
if ins~haserror then
  writeln_('Error: ',ins~getlasterror)
else
  forall (region in Regions, month in Months |
      exists(Prices(region,month))) do
    writeln('Price in ', region, ' for month #', month, ': ',
        Prices(region,month))
  end-do
end-if
Example of fetching some values from an array entity.
Further information
1. The destination must be an array of a string, text, integer, real, boolean, or any. It must have the same number of index sets as the array in the Insight scenario, but their type may be string, text, constant text, integer, real, boolean, or any
2. If the destination is an array, the fetched element will be inserted into that array with the supplied index keys. In this case, the types of the index values must match the type of the index sets of the array.
3. If the entity type does not match the type of the array, or an index type in the Insight scenario does not match the type of the corresponding index in the destination, the value will be converted (e.g. a real type entity would be be rounded to be stored in an integer).
4. Filters are passed as a list containing, for each index set, a list of the acceptable values. An empty list is interpreted as meaning any value is acceptable. Only array elements whose indexes pass all filters will be fetched.
5. Any content in array cells not updated by this fetch will be retained.
6. This function cannot fail; invalid parameter values will only cause an error when the returned value is passed to ins~getscendata.
Related topics

© 2001-2025 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.