Skip to main content
Question

Index outside the bounds of array


Forum|alt.badge.img
  • Freshman I
  • 41 replies

Community,

I’m stuck on this error.  The formula does validate, but then errors out.

Formula:

=iif([AMConfigResultsOption.Included] = 'True' AND [AMConfigurationOption.Label] = 'TCO202-BK', '','X','') OR iif([AMConfigResultsOption.Included] = 'False' AND [AMConfigurationOption.Label] = 'TCO202-BK' ,' ', )

This is what comes up when I click Stack Trace:

 

I have tried the formula with 1 or 0, instead of True or False.  And I still get the error.

Any feedback is welcome.

Thank you,

Trisha

 

2 replies

Forum|alt.badge.img+1
  • Jr Varsity II
  • 37 replies
  • March 4, 2024

The IIF statement you included would not run as you currently have it set. The syntax for IIF is: IIF(expr, true, false). This may just be due to pasting issues from your report, but your 1st IIF Statement has an extra section, and the 2nd does not have anything in the False result portion.

 

Also your stack trace screenshot does not include the error message. Try finding the entry that has an entry under the “Exceptions” tab, as that should give you more information on the specific error.

 

Are you using this in a report section (such as visibility expr), or in a text box on the actual report? It seems like on the actual report as there are output values, but you likely will also want to combine the OR parts of your statement into the False section of your 1st IIF statement:

 

IIF( True and Label = ‘XXX’, ‘X’, IIF(False and Label = ‘XXX’ , ‘Y’,’Z’))

 

Alternatively you could do something like:

 

IIF(Label = ‘XXX’, iif(Included = True, ‘X’, ‘Y’), ‘Z’)

 

There are normally multiple different ways to ‘chain/nest’ IIF statements that can be pretty powerful, a lot depends on your data classes involved and your end goal.

 

 


Forum|alt.badge.img
  • Author
  • Freshman I
  • 41 replies
  • March 19, 2024

@mbridges00 ,

Good day,

I am back working on this again.  I was able to get the formula to ‘validate’, but then I receive a message ‘Index was outside the bounds of the array’.  

This is my formula:

=iif([AMConfigResultsOption.Included] = True AND [AMConfigurationOption.Label] = 'TCO702', 'X ',iif([AMConfigResultsOption.Included] = False AND [AMConfigResultsOption.InventoryID] = 'N/A ', ' ' ))

 

My first question is, for the ‘included’ part of the DAC, how do I know if I should use True/False spelled out or as a number? 1 or 0?  On the DAC it when I click the filter, it offers True/False to filter by, so I assumed that is how it would pull it in.

For the trace error, it is saying ‘System.IndexOutOfRangeException. 

Exception Trace Error

 

Thank you,

Trisha


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings