Question

Index outside the bounds of array

  • 4 March 2024
  • 2 replies
  • 74 views

Userlevel 4
Badge

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

Userlevel 3
Badge +1

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.

 

 

Userlevel 4
Badge

@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


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved