Example message text
In the call to MdArrayToTable(A, I, L), the length of the result index «I» is not consistent with the dimensions being transformed as specified in «L». Your result index, Row, has 60 elements, but to be consistent with «L», it must have 30 elements, since this is the total number of combinations of Time and Project (the index column(s) listed in «L»), and the number of cells in «A»[Scenario = 1, Run = 1].
In the call to MdArrayToTable(A, I, L), the length of the result index «I» is not consistent with the dimensions being transformed as specified in «L». Your result index, Row, has 60 elements, but to be consistent with «L», it must have either 30 or 23 elements.
There are 30 total combinations of Time and Project (i.e., the index column(s) listed in «L»). Thus, if you want to include all cells of «A» in the result, «I» should have 30 elements. «A»[Scenario = 1, Run = 1] contains 23 non-zero/non-null values, so if you only want to include cells with non-zero/non-null values in the result, «I» should have 23 elements.
When you use MdArrayToTable, you must provide a result indexof the appropriate length as the «I» parameter, and you must also specify (via the «L» parameter) the set of indexes of «A» that are being transformed into a relational table. This error results when the length of your index «I» is not consistent with the indexes being operated on by the transformation.
In the most obvious case, every index in «A» is transformed, so that the number of columns in the result is one greater than the number of dimensions of «A». In this case, the length of your result index «I» should equal the number of cells in «A» (or the number of non-zero/non-null cells in «A»).
However, when extra dimensions get added to your model, like nearly every other function in Analytica, MdArrayToTable array-abstracts. Those extra dimensions aren't listed in «L», so they aren't used in the transformation.
In general, each index of «A» can either be included in the transformation or array-abstracted over. Those used in the transformation appear as columns in the result, and therefore need to be listed as one of the elements of «L» (but not as the final element of «L», which serves as the value column). For those indexes (if any) that are array-abstracted, the transformation is applied to each slice of «A» along those dimensions, so those indexes do not appear in «L», and they will appear as a dimension of the final result. You will encounter this error if you do not have the intended set of indexes in «L».
The bottom line is that there are two possible mistakes that you are making when you encounter this error. You may have miscalculated the number of elements required in «I», or you may have incorrectly specified the indexes that appear in «L». To figure out which error you are making, you really need to carefully consider the dimensionalities involved, and which columns you really want in your final relational table. It is okay to have a set of relational tables, indexed by the extra indexes -- sometimes that is what you want.
Another possible mistake that can lead to this error is that you may have forgotten to include a final element in «L» for the result column. If you only listed your indexes in «L», the last one will be ignored, since the final column is used to store the array value in the final relational table returned by MdArrayToTable. For example, if you defined «L» as
['I', 'J', 'K'], you have only specified a transformation over indexes
J. The last element,
'K', is a placeholder for the final value, so it isn't used as one of the transformation indexes.
Re-calculate the number of elements required in «I», specify the correct indexes that appear in «L» and make sure to include a final element in «L» for the result column.