Multiple Imports in same process Using Anaplan Connect

Yashabh
Occasional Contributor

Multiple Imports in same process Using Anaplan Connect

Hi All,

 

I have 50 files in similar format but for different entities and different file names. Now, i only need one process to import these and the same is set up using "entity 1" and works perfect when using dashboard action.

Now I created a Anaplan connect import script with 50 different file names & File path's and Anaplan connect just loads the file from entity 1 that is on server ,50 times.

 

FYI: The connect script works perfectly if i use 50 different processes for each entity.   

 

 

Any help would be appreciated!!

 

11 REPLIES 11
rob_marshall
Moderator

Re: Multiple Imports in same process Using Anaplan Connect

@Yashabh 

 

Just a thought, but why would you not combine that data into one file and just load it.  This way, you will only have one import action.

 

Rob

DaanishSoomar
Certified Master Anaplanner

Re: Multiple Imports in same process Using Anaplan Connect

Hello @Yashabh,

 

This is an interesting post! I recently ran into a similar situation myself. This seemingly may be an issue of "order of operations". 

 

Before we go down the path of troubleshooting the script, do you see any potential way to create the file in such a way where everything is consolidated in 1 file? The best solution sometimes is fixing the data upstream.  If not, let's continue troubleshooting.

 

Would you mind sharing a masked copy of your script? I can take a look.

 

Essentially what you will need to do is create a script that follows the following:

 

1) Load file 1 to Anaplan Server

2) Run process executing the file 1 load and subsequent actions

3) Load file 2....repeat etc.

Yashabh
Occasional Contributor

Re: Multiple Imports in same process Using Anaplan Connect

Hi @DaanishSoomar 

 

I tried the option to execute process after each upload, but its erroring out. Sharing the script below:


set AnaplanUser="name & ID"
set WorkspaceId="WorkspaceID"
set ModelId="ModelID"
set ServiceUrl="https://api.anaplan.com"
set AuthUrl="https://auth.anaplan.com"

set FileName="xyz.csv"
set FilePath="C:\Users\xyz.csv"
set ProcessName="Import Data"
set DumpName="C:\Users\xyx.txt"
set Chunksize=1

set Operation=-debug -service %ServiceUrl% -auth %AuthUrl% -workspace %WorkspaceId% -model %ModelId% -chunksize %Chunksize%^
-file %FileName% -put %FilePath% -process %ProcessName% -execute -output %DumpName%


set FileName1="ABC.csv"
set FilePath1="C:\Users\ABC.csv"
set ProcessName1="Import Data"
set DumpName1="C:\Users\ABC.txt"
set Chunksize=1

set Operation=-debug -service %ServiceUrl% -auth %AuthUrl% -workspace %WorkspaceId% -model %ModelId% -chunksize %Chunksize%^
-file %FileName1% -put %FilePath1% -process %ProcessName1% -execute -output %DumpName1%

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

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

 

DaanishSoomar
Certified Master Anaplanner

Re: Multiple Imports in same process Using Anaplan Connect

Thanks for sharing @Yashabh. May I ask what is the error message you are facing when you run the script this way?

 

The conflict may arise as you have 2 operation lines with the same variable name. Try combining both operation lines into 1 or rename the second operation line to "Operation1".

 

Try also limiting the duplicate parameters/variables as they are redundent. 

 

set AnaplanUser="name & ID"
set WorkspaceId="WorkspaceID"
set ModelId="ModelID"
set ServiceUrl="https://api.anaplan.com"
set AuthUrl="https://auth.anaplan.com"

set FileName="xyz.csv"
set FilePath="C:\Users\xyz.csv"
set ProcessName="Import Data"
set DumpName="C:\Users\xyx.txt"
set Chunksize=1

set Operation=-debug -service %ServiceUrl% -auth %AuthUrl% -workspace %WorkspaceId% -model %ModelId% -chunksize %Chunksize%^
-file %FileName% -put %FilePath% -process %ProcessName% -execute -output %DumpName%


set FileName1="ABC.csv"
set FilePath1="C:\Users\ABC.csv"
set ProcessName1="Import Data"
set DumpName1="C:\Users\ABC.txt"
set Chunksize1=1

set Operation1=-debug -service %ServiceUrl% -auth %AuthUrl% -workspace %WorkspaceId% -model %ModelId% -chunksize %Chunksize1%^
-file %FileName1% -put %FilePath1% -process %ProcessName1% -execute -output %DumpName1%

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

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

Yashabh
Occasional Contributor

Re: Multiple Imports in same process Using Anaplan Connect

Hey @DaanishSoomar ,

First of all, thanks for your prompt responses.

 

I modified the script to have just entity "2" - The file first gets uploaded but while running process i get error "The uploaded file is no longer available; please upload the file again".

 

However if i match the csv name from entity "1"  the import works. 

It looks like , its behaving somewhat similar to when we run processes from Action pane.

 

 

 

 

 

DaanishSoomar
Certified Master Anaplanner

Re: Multiple Imports in same process Using Anaplan Connect

So running the action in the default pane will trigger Anaplan to run with the "default file" that you created the action with. 

 

When you run the action with Anaplan Connect, it loads the file which you point to as the "latest file". What I would do is recreate the Action with the "latest file". This will convert it to also become the "default file". All of the files in your Anaplan Connect script should match the format/structure of the default file. 

 

Let me know if you have any questions. 

Yashabh
Occasional Contributor

Re: Multiple Imports in same process Using Anaplan Connect

@DaanishSoomar 

 

All the files do match the format , but the name is different.

I believe then, going with 50 actions, seems to be option right now if we can't consolidate the source files.

DaanishSoomar
Certified Master Anaplanner

Re: Multiple Imports in same process Using Anaplan Connect

Hey @Yashabh,

 

Got it. In that case, what I would reccommend is instead of 50 actions, you could create a "Master Script".

 

This is an article which I contributed to the Anaplan Community Best Practices, it is scheduled to be released in a couple weeks, but see if you can access this link.

 

This method of scripting might help serve your needs. Let me know if you have any questions!

 

https://community.anaplan.com/t5/Content-Sandbox/SCHEDULED-Anaplan-Connect-Best-Practices-Master-Scr...

rob_marshall
Moderator

Re: Multiple Imports in same process Using Anaplan Connect

@Yashabh @DaanishSoomar 

 

Creating 50 actions is not the way to go, it is best to put the data into one file and load that.  50 actions will take longer to process than just one file with the same data in it.