Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] Copy files if exist from a database

Hi,
i have multiple files to copy if exist. I get their name in a database but i don't know how to use them in the tFileExist component

tMysqlInput ---> tMap --> extract file name --> If exist, copy it
                              |
                              |-----> tMysqlOut --> etc.

Labels (2)
1 Solution

Accepted Solutions
Jcs19
Creator II
Creator II

ddelhoume wrote:
Hi Jcs19, thanks for the help.

TMysqlOuput is used for copy one DB to another, This works great.

Maybe my explanation of my issue is not clear.
I have files in a directory (source) to copy to another (target) but ONLY if this file is referenced in the source DB.

When i try to copy file that doesn't exists in the source dir, job failed with "File XXXX does not exist".

So i tried to use tFileExist component to test the file but i don't known how to connect tMap to tFileExist.

I tried with a tMap --> tFlowToIterate ---> tFileExist -->(On Component OK) --> tFileCopy

but don't work, it seems tFileExists always answer 'OK', event if the file is missing.

Oh ok, I misunderstood
Can you try to replace "On component OK" by runIf ? In runIf you put ((Boolean)globalMap.get("tFileExist_1_EXISTS")) 
It means if tFileExist = true. 

To use if tFileExist = false you can use  !((Boolean)globalMap.get("tFileExist_1_EXISTS")) 

tFileExist seems to always returns 'OK' because OncomponentOk checks if the component worked but not if the file exists

View solution in original post

4 Replies
Jcs19
Creator II
Creator II

after your "extract file name--->" you will have to loop in a folder and use tFileExist
To loop a folder use tFistList

What is tMysqlOut used for
Anonymous
Not applicable
Author

Hi Jcs19, thanks for the help.

TMysqlOuput is used for copy one DB to another, This works great.

Maybe my explanation of my issue is not clear.
I have files in a directory (source) to copy to another (target) but ONLY if this file is referenced in the source DB.

When i try to copy file that doesn't exists in the source dir, job failed with "File XXXX does not exist".

So i tried to use tFileExist component to test the file but i don't known how to connect tMap to tFileExist.

I tried with a tMap --> tFlowToIterate ---> tFileExist -->(On Component OK) --> tFileCopy

but don't work, it seems tFileExists always answer 'OK', event if the file is missing.
Jcs19
Creator II
Creator II

ddelhoume wrote:
Hi Jcs19, thanks for the help.

TMysqlOuput is used for copy one DB to another, This works great.

Maybe my explanation of my issue is not clear.
I have files in a directory (source) to copy to another (target) but ONLY if this file is referenced in the source DB.

When i try to copy file that doesn't exists in the source dir, job failed with "File XXXX does not exist".

So i tried to use tFileExist component to test the file but i don't known how to connect tMap to tFileExist.

I tried with a tMap --> tFlowToIterate ---> tFileExist -->(On Component OK) --> tFileCopy

but don't work, it seems tFileExists always answer 'OK', event if the file is missing.

Oh ok, I misunderstood
Can you try to replace "On component OK" by runIf ? In runIf you put ((Boolean)globalMap.get("tFileExist_1_EXISTS")) 
It means if tFileExist = true. 

To use if tFileExist = false you can use  !((Boolean)globalMap.get("tFileExist_1_EXISTS")) 

tFileExist seems to always returns 'OK' because OncomponentOk checks if the component worked but not if the file exists
Anonymous
Not applicable
Author

You did it! 🙂
It works, thanks.


Un grand merci de Toulouse 😉