Expand my Community achievements bar.

SOLVED

Export directory

Avatar

Level 4

Hi all,

so in our Adobe Campaign we have different users, each one of them have it's own workflows, and have it's own exports.

the issue here that all the exports that the users do, go to the same folder in the server, i would like to create something (workflow or script) that take the file exported to a user folder, the user who did the export.

to explain it more here is an example:

we have the admin and 2 users, A and B, and the file X.txt.

-if the Admin did the export, the file exported will go to \Export_Files\X.txt

-if the user A who did the export, the file needs to go to \Export_Files\Files_A\X.txt

-if the user B exported a file, it should go to \Export_Files\Files_B\X.txt

Regards,

Badr.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi,

Add <%= application.operator.login %> to your export path:

  • \Export_Files\Files_<%= application.operator.login %>\X.txt

Thanks,

-Jon

View solution in original post

7 Replies

Avatar

Employee Advisor

Hi Badr,

Typically with Campaign, we recommend using an SFTP server for any file import and export needs.  The reason being is that it's easier to transfer files and maintain versus exporting the files to the local server which usually has more access restrictions.

Let us know if SFTP isn't an option.

Regards,

Craig

Avatar

Level 4

Hi Badr,

I don't think you can do that in an automated/systematic way. The A/B users can select the destination directory when exporting their campaign files on the server.

You can set few environment variables in the configuration instance file to cond

XTK_SHARED_DIR=

And

exportDirectory="$(XTK_SHARED_DIR)/var/$(INSTANCE_NAME)/export/"

uploadDirectory="$(XTK_SHARED_DIR)/var/$(INSTANCE_NAME)/upload/"

workingDirectory="$(XTK_SHARED_DIR)/var/$(INSTANCE_NAME)/work-space/">

Keep in mind that this is an instance setting and not per user setting. All exports are taking place as neolane user.

You can still create output/export templates per user and you can set the export directory for each user template (doesn't worth the efforts since if users don't know how to set/change the export directory in the export activity node then it is much bigger concern )

Ability to export the campaign/extract files into a local directory on the app server is important since many clients require additional QC steps before the final files are delivered to their destination partners/vendors and the client may restrict the file transfer to/from the ACC environment to their own suite of tools for security reason. assuming here a hybrid ACC deployment.

I hope this is useful.

Avatar

Level 4

Thanks Craig and Abdul for your answers,

What i just read from your answers is so helpful but isn't my case here.

After a normal export all the files go to an export folder by default, then we have a workflow with a DOS Batch script that get executed every 20 minutes, and take all the files from the export folder and analyse them, after that, put each file in the user folder, here is the code that we use :

@echo off

SETLOCAL enableextensions enabledelayedexpansion

echo execute Export Script

set directory=G:\nac00\bin\Neolane\AdobeCampaignv6\var\nac_Homolog\export

set target_directory=!directory!\completed_files

set sql_file=!directory!\sql

set files_logs=!directory!\logs

if EXIST !directory! ( echo el directorio !directory! existe ) ELSE ( echo el directorio  !directory!  no existe )

if EXIST !target_directory! ( echo el directorio !target_directory! existe ) ELSE ( echo el directorio  !target_directory!  no existe )

if EXIST !sql_file! ( echo el directorio !sql_file! existe ) ELSE ( echo el directorio  !sql_file!  no existe )

if EXIST !files_logs! ( echo el directorio !files_logs! existe ) ELSE ( echo el directorio  !files_logs!  no existe )

set FECHA_COMPLETA=%date:~0,2%_%date:~3,2%_%date:~6,4% %time:~0,2%:%time:~3,2%:%time:~6,2%

set libelle_zip=%date:~0,2%%date:~3,2%%date:~6,4%%time:~0,2%%time:~3,2%%time:~6,2%

if EXIST !directory! ( echo el directorio !directory! existe ) ELSE ( echo el directorio  !directory!  no existe )

if EXIST !target_directory! ( echo el directorio !target_directory! existe ) ELSE ( echo el directorio  !target_directory!  no existe )

if EXIST !sql_file! ( echo el directorio !sql_file! existe ) ELSE ( echo el directorio  !sql_file!  no existe )

if EXIST !files_logs! ( echo el directorio !files_logs! existe ) ELSE ( echo el directorio  !files_logs!  no existe )

set FECHA_COMPLETA=%date:~0,2%_%date:~3,2%_%date:~6,4% %time:~0,2%:%time:~3,2%:%time:~6,2%

set libelle_zip=%date:~0,2%%date:~3,2%%date:~6,4%%time:~0,2%%time:~3,2%%time:~6,2%

echo ( generating files to export... please wait... )

IF NOT EXIST !directory!\ mkdir !directory!\

IF NOT EXIST !target_directory!\ mkdir !target_directory!\

IF NOT EXIST !files_logs!\ mkdir !files_logs!\

echo checking directory...

if EXIST !directory!\\*.* (

for %%x in (!directory!) do set /a count+=1

echo  total fichero: !count!

for %%a in (!directory!\*.*) do (

set fichero=%%~nxa

echo Fichero a revisar !fichero!

REM for /F "delims=" %%a in (!directory!\*.*) do (

REM InterfaceMDM

set interface=!fichero:~0,11!

IF NOT !interface! == "InterfaceMDM" (

set /A xresult=0

FOR /F "usebackq delims=!" %%s IN (` sqlplus -S NAC00/iheP8231@beox1d1v/DAC00_PRO @!sql_file!\export.sql !fichero! `) DO set /A xresult=%%s

echo estado Workflow !xresult!

if [!xresult!]==[5] (

set filialfolder=""

FOR /F "usebackq delims=!" %%m IN (` sqlplus -s NAC00/iheP8231@beox1d1v/DAC00_PRO @!sql_file!\folder_file.sql !fichero! `) DO set filialfolder=%%m

echo detectado Filial !filialfolder!

if not exist !target_directory!\!filialfolder! mkdir !target_directory!\!filialfolder!

if exist "!directory!\!fichero!" copy "!directory!\!fichero!" "!target_directory!\!filialfolder!\!fichero!"

echo !directory!\!fichero!

echo copy to 

echo !directory!\!fichero! !target_directory!\!filialfolder!\!fichero!

del "!directory!\!fichero!"

) ELSE (

echo Fichero no encontrado movido a !target_directory!\!fichero!.

copy "!directory!\!fichero!" "!target_directory!\!fichero!"

del "!directory!\!fichero!"

)

if exist !directory!\files_!libelle_zip!.txt copy !directory!\files_!libelle_zip!.txt !target_directory!\files_!libelle_zip!.txt

) ELSE (

echo fichero ignorado !interface!

)

)

) ELSE (

echo Fichero no encontrado e ignorado

)

This code stopped working (still not understanding the reason why), i tried to read it and figure it out but my knowledge with DOS Batch is very limited.

so if any one here can explain a little this code to me and what can be wrong with it, or a new way to do the same, to know the user who did the exported file and move the file to his folder.

Thanks,

Badr.

Avatar

Level 4

Badr,

Having a service file watcher process (OS scheduled process or a service) or a post delivery/export activity node in ACC can do part of the work but still the ability to identify files extracted by specific users and move them to different directories is challenging.

For example, you can have a file watcher process (OS scheduled script) to look for files with *_A.txt suffix and move them to final destination folder xxxxx_A while moving files with *_B.txt suffix to a different destination directory. It is still the user duty to either set the exported file name to *_A.txt or *_B.txt by either doing that manually or by using an export template. Any automation using javascript to get the user ID as a variable and include in the file name does not worth it. It is better to re-evaluate the requirements for this part and determine a reasonable approach.

Good luck.

Thanks.

Avatar

Level 4

Hi Abdul and thank you for your answer,

what you just told me gave me an idea if it can be possible, cause ive a kind of javascript code who can move files from a folder to an other, and there i can use some condtions but based on the file name.

my question here is if there is a way to add the user name automatically to an export file? from a data schema for example?

Thanks,

Badr.

Avatar

Correct answer by
Community Advisor

Hi,

Add <%= application.operator.login %> to your export path:

  • \Export_Files\Files_<%= application.operator.login %>\X.txt

Thanks,

-Jon

Avatar

Level 4

Hi Jon and thank you so much for your answer,

This is exactly what i need.

If you can please help me more to know where i can find a schema or a form of the export that the workflows use to add that part of login, to be generated automatically with the name or the path of the file exported, without the user add it.

Thanks,

Badr.