Anaplan Connect - Put file gives Array Index Out of Bounds

Hi,

 

I am having some issues with running one of my Anaplan Connect scripts to import a file & run a process.

When trying to upload the file, I receive an error "Array Index Out of Bounds: 0".

 

When I run the process from the Anaplan website and import the same file there, it works perfectly.

When I run the script, using only the first 3 lines of the file as input file, the script also runs perfectly. My guess is that the issue is with the input file, but I cannot figure out what the problem would be.

clipboard_image_0.png

The input file is attached. Below you can also find a copy of the script:

 

@echo off
rem For Windows OS : This example explains the usage of basic Authentication with Anaplan Connect.
rem It also loads a source text file and runs an Anaplan import into a module.
rem For details of how to configure this script visit https://help.anaplan.com/anapedia/Content/Downloads/DL_Downloads.html

set AnaplanUser="userid:pw"
set WorkspaceId="workspaceID"
set ModelId="ModelID"
set ServiceUrl="https://api.anaplan.com"
set AuthUrl="https://auth.anaplan.com"
set FileName="ANA_Mat_Plant_Attr.csv"
set FilePath="...\ANA_Mat_Plant_Attr.csv"
set DumpName="dump/path/here"
set Chunksize=1

set Operation=-debug -service %ServiceUrl% -auth %AuthUrl% -workspace %WorkspaceId% -model %ModelId% -chunksize %Chunksize% -file %FileName% -put %FilePath% -process "Import SKU / Plant" -execute -output %DumpName%

rem *** End of settings - Do not edit below this line ***

setlocal enableextensions enabledelayedexpansion || exit /b 1
cd %~dp0
if not %AnaplanUser% == "" set Credentials=-user %AnaplanUser%
set Command=.\AnaplanClient.bat %Credentials% %Operation%
@echo %Command%
cmd /c %Command%
pause

 

Thanks.

Answers

  • Do you want to run only an import action, or do you want to run a process that has the import action built in the process?
  • I'd move "-chunksize %Chunksize%" after "-put %FilePath%"
  • Run an process which has an import embedded indeed, that's why I need to upload the file.

  • Moving the chunksize part after the put did unfortunately not solve the issue. In my other scripts I follow the same logic & there it works smoothly.

  • Did you ever get this figured out?  I'm running into the same problem.  This script is almost exactly like another one that is working perfectly, so it's really baffling me.

  • Hello @kboothe 

     

    How is your source file delimitted is it similar to the other script's source file? One other item I would check is the chunk size when you are uploading to anaplan connect, it might be worth increasing it.

  • Hello @Ankit 

     

    Thanks so much for your suggestions.  I think I may be getting close.  Both source files are delimited with "|".  I have increased the chunksize to 50, but I'm still getting the Array index out of bounds error.  The problem does seem to be the source file though.  It was 23K lines, so I deleted 8K and the error disappeared.  I think I will try validating the data in the 8K . . . unless you have any other suggestions.

  • FYI to anyone else receiving the array index out of bounds error, I was finally able to resolve it by placing the chunksize after Modelid in the set operation (it was originally after the filename).

  • I ran into this issue this week and raised a support ticket. The source of the error was the use of more than one delimiter in the file definition. This seems to be a known issue with Anaplan Connect V1.4.x.

     

    To correct the issue update your file definition, Imports > Import Data Sources, and change delimiter selection so that you only use a single delimiter.

  • Ran into this issue importing into a list with Anaplan Connect, after many successful runs over a period of months. An increase in volume seems to have introduced the problem. Coincidentally or not, the import file is larger than the chunk. There is only one field in the file. I tried specifying 1 and 0 delimiters in the import definition, and tried with or without a string delimiter. In the anaplan client script call, the chunksize parameter is immediately after model ID. Has anyone else experienced something similar or have other suggestions?

  • Adding a second field to the input file, with a comma delimiter, then updating the import map seems to have resolved the 'Array index out of bounds' error for now.

  • Hello  sean_culligan

     

    I am facing "Array index out of bounds" when I import data for the first time then I manually change delimter to comma in Import data source as you mention and it works. But for the first time, delimeter I could see "|" instead ",". When I manually upload file with comma separator it works perfect.  

     

    How could I change delimter at first instance ? do I need to specify , in script 

     

    set Operation=-debug -service %ServiceUrl% -auth %AuthUrl% -workspace %WorkspaceId% -model %ModelId% -chunksize %Chunksize% -file %FileName% -put %FilePath% -import %ImportName% -execute -output "C:\Workspace\Anaplan\anaplan-connect\errors\My Errors.txt"

     

    Could you please help me on this 

  • @rahulnair The delimiter of the file is defined when you 'upload the file' in Anaplan. If you wish to update an existing source file definition go to the actions screen, and select import data sources. Then upload the file again (with the original name).

     

    In this screen you should be able to set the delimiter. If you want it to be a comma set it as such. 

     

    When you run the import process via the API this uses the file format which was defined. So it should not change based on the data you are importing. If you are really stuck send me a message directly and we can arrange a private conversation on this one. As it may be better to have a quick look at it.

  • Thanks @sean_culligan for the reply. this is resolved, Thanks again!
  • @rahulnair thanks for confirming, good to hear it is resolved.

  • I am getting this error currently.  The processes to upload have not changed; chunk size set to 20mb and after the model ID in the set operation.  File is pipe delimited only ("|") and I get the error regardless of whether the file has 250k records or just 85k.

     

    Any steps or pieces to check would be greatly appreciated.  Using Anaplan Connect 1.4.2