Friday, 18 July 2008

Access Value of Slice by Index or Date

To read or write the value of an item with slices, you can either specify the slice directly (item[slice]; the first slice has index 0, and so on) or indicate the date as at which you want to read/write the value.

Syntax:
ItemId[slice] or
ItemId[{date}]

Example:
MY_ITEM with the following three slices
01.07.2008 to 15.07.2008: 20
16.07.2008 to 31.07.2008: 28

To identify the value of the item of the second slice use either:

  • index (starting with 0)
    x = MY_ITEM[1]
  • date (any date that falls within the period of the slice)
    x = MY_ITEM[{2008-07-16}]
    x = MY_ITEM[{2008-07-18}]
    x = MY_ITEM[{2008-07-31}]

To modify the value of the second slice use either:

  • index (starting with 0)
    MY_ITEM[1] = 29
  • date (any date that falls within the period of the slice)
    MY_ITEM[{2008-07-16}] = 29
    MY_ITEM[{2008-07-18}] = 29
    MY_ITEM[{2008-07-31}] = 29

Note: It is also possible to combine this type of access with the access by node structure index:

NodeStructureID[Index].ItemId[slice] or
NodeStructureID[Index].ItemId[{date}]

No comments: