Talend get current filename












0















I want to load excel files into the mysql database and check that they do not already exist, my problem is that I can not extract the name of the current file.



For example, I have the following files A.xlsx, B.xlsx and C.xls.



It return always B.xlsx



enter image description here










share|improve this question

























  • Welcome @huda_tt. Can you try to give a bit more detail about what is happening? Could you include examples? When you say "it always returns" can you say what "it" is? Where are you trying to get the filename from? In which component?

    – Screwtape
    Nov 20 '18 at 9:30











  • hi @Screwtape I want to extract the current filename first in the "tdatabaseinput" to make the query {"SELECT processedfile.NOM FROM processedfile WHERE NAME = '" + ((String) globalMap.get ("tFileList_1_CURRENT_FILE")) + "'" } if it does not already exist I want to insert it (current file name) in the mysqltable "prossedfile" using "tfixedflowinput" but the value inserted is always the same ~$B.xlsx

    – huda tt
    Nov 20 '18 at 9:56











  • The link between tFileLink_1 and tFixedFlowInput_1 is not iterating - it will only pick up the (first/last?) iteration. Try running your subjob from a "run if" from the "disponibilite_3g" component, or even the map component.

    – Screwtape
    Nov 20 '18 at 10:20











  • ok @Screwtape i try to do this job to extract current filename and identifie the probleme [enter image description here][1] but i still have the name of latest file [enter image description here][2] [enter image description here][3] [enter image description here][4] [1]: i.stack.imgur.com/FFjk3.png [2]: i.stack.imgur.com/Ia6RW.png [3]: i.stack.imgur.com/wi3bW.png [4]: i.stack.imgur.com/ETqOu.png

    – huda tt
    Nov 20 '18 at 12:44
















0















I want to load excel files into the mysql database and check that they do not already exist, my problem is that I can not extract the name of the current file.



For example, I have the following files A.xlsx, B.xlsx and C.xls.



It return always B.xlsx



enter image description here










share|improve this question

























  • Welcome @huda_tt. Can you try to give a bit more detail about what is happening? Could you include examples? When you say "it always returns" can you say what "it" is? Where are you trying to get the filename from? In which component?

    – Screwtape
    Nov 20 '18 at 9:30











  • hi @Screwtape I want to extract the current filename first in the "tdatabaseinput" to make the query {"SELECT processedfile.NOM FROM processedfile WHERE NAME = '" + ((String) globalMap.get ("tFileList_1_CURRENT_FILE")) + "'" } if it does not already exist I want to insert it (current file name) in the mysqltable "prossedfile" using "tfixedflowinput" but the value inserted is always the same ~$B.xlsx

    – huda tt
    Nov 20 '18 at 9:56











  • The link between tFileLink_1 and tFixedFlowInput_1 is not iterating - it will only pick up the (first/last?) iteration. Try running your subjob from a "run if" from the "disponibilite_3g" component, or even the map component.

    – Screwtape
    Nov 20 '18 at 10:20











  • ok @Screwtape i try to do this job to extract current filename and identifie the probleme [enter image description here][1] but i still have the name of latest file [enter image description here][2] [enter image description here][3] [enter image description here][4] [1]: i.stack.imgur.com/FFjk3.png [2]: i.stack.imgur.com/Ia6RW.png [3]: i.stack.imgur.com/wi3bW.png [4]: i.stack.imgur.com/ETqOu.png

    – huda tt
    Nov 20 '18 at 12:44














0












0








0


1






I want to load excel files into the mysql database and check that they do not already exist, my problem is that I can not extract the name of the current file.



For example, I have the following files A.xlsx, B.xlsx and C.xls.



It return always B.xlsx



enter image description here










share|improve this question
















I want to load excel files into the mysql database and check that they do not already exist, my problem is that I can not extract the name of the current file.



For example, I have the following files A.xlsx, B.xlsx and C.xls.



It return always B.xlsx



enter image description here







filenames talend






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 20 '18 at 2:35









RealHowTo

27.6k96076




27.6k96076










asked Nov 19 '18 at 22:56









huda tthuda tt

1




1













  • Welcome @huda_tt. Can you try to give a bit more detail about what is happening? Could you include examples? When you say "it always returns" can you say what "it" is? Where are you trying to get the filename from? In which component?

    – Screwtape
    Nov 20 '18 at 9:30











  • hi @Screwtape I want to extract the current filename first in the "tdatabaseinput" to make the query {"SELECT processedfile.NOM FROM processedfile WHERE NAME = '" + ((String) globalMap.get ("tFileList_1_CURRENT_FILE")) + "'" } if it does not already exist I want to insert it (current file name) in the mysqltable "prossedfile" using "tfixedflowinput" but the value inserted is always the same ~$B.xlsx

    – huda tt
    Nov 20 '18 at 9:56











  • The link between tFileLink_1 and tFixedFlowInput_1 is not iterating - it will only pick up the (first/last?) iteration. Try running your subjob from a "run if" from the "disponibilite_3g" component, or even the map component.

    – Screwtape
    Nov 20 '18 at 10:20











  • ok @Screwtape i try to do this job to extract current filename and identifie the probleme [enter image description here][1] but i still have the name of latest file [enter image description here][2] [enter image description here][3] [enter image description here][4] [1]: i.stack.imgur.com/FFjk3.png [2]: i.stack.imgur.com/Ia6RW.png [3]: i.stack.imgur.com/wi3bW.png [4]: i.stack.imgur.com/ETqOu.png

    – huda tt
    Nov 20 '18 at 12:44



















  • Welcome @huda_tt. Can you try to give a bit more detail about what is happening? Could you include examples? When you say "it always returns" can you say what "it" is? Where are you trying to get the filename from? In which component?

    – Screwtape
    Nov 20 '18 at 9:30











  • hi @Screwtape I want to extract the current filename first in the "tdatabaseinput" to make the query {"SELECT processedfile.NOM FROM processedfile WHERE NAME = '" + ((String) globalMap.get ("tFileList_1_CURRENT_FILE")) + "'" } if it does not already exist I want to insert it (current file name) in the mysqltable "prossedfile" using "tfixedflowinput" but the value inserted is always the same ~$B.xlsx

    – huda tt
    Nov 20 '18 at 9:56











  • The link between tFileLink_1 and tFixedFlowInput_1 is not iterating - it will only pick up the (first/last?) iteration. Try running your subjob from a "run if" from the "disponibilite_3g" component, or even the map component.

    – Screwtape
    Nov 20 '18 at 10:20











  • ok @Screwtape i try to do this job to extract current filename and identifie the probleme [enter image description here][1] but i still have the name of latest file [enter image description here][2] [enter image description here][3] [enter image description here][4] [1]: i.stack.imgur.com/FFjk3.png [2]: i.stack.imgur.com/Ia6RW.png [3]: i.stack.imgur.com/wi3bW.png [4]: i.stack.imgur.com/ETqOu.png

    – huda tt
    Nov 20 '18 at 12:44

















Welcome @huda_tt. Can you try to give a bit more detail about what is happening? Could you include examples? When you say "it always returns" can you say what "it" is? Where are you trying to get the filename from? In which component?

– Screwtape
Nov 20 '18 at 9:30





Welcome @huda_tt. Can you try to give a bit more detail about what is happening? Could you include examples? When you say "it always returns" can you say what "it" is? Where are you trying to get the filename from? In which component?

– Screwtape
Nov 20 '18 at 9:30













hi @Screwtape I want to extract the current filename first in the "tdatabaseinput" to make the query {"SELECT processedfile.NOM FROM processedfile WHERE NAME = '" + ((String) globalMap.get ("tFileList_1_CURRENT_FILE")) + "'" } if it does not already exist I want to insert it (current file name) in the mysqltable "prossedfile" using "tfixedflowinput" but the value inserted is always the same ~$B.xlsx

– huda tt
Nov 20 '18 at 9:56





hi @Screwtape I want to extract the current filename first in the "tdatabaseinput" to make the query {"SELECT processedfile.NOM FROM processedfile WHERE NAME = '" + ((String) globalMap.get ("tFileList_1_CURRENT_FILE")) + "'" } if it does not already exist I want to insert it (current file name) in the mysqltable "prossedfile" using "tfixedflowinput" but the value inserted is always the same ~$B.xlsx

– huda tt
Nov 20 '18 at 9:56













The link between tFileLink_1 and tFixedFlowInput_1 is not iterating - it will only pick up the (first/last?) iteration. Try running your subjob from a "run if" from the "disponibilite_3g" component, or even the map component.

– Screwtape
Nov 20 '18 at 10:20





The link between tFileLink_1 and tFixedFlowInput_1 is not iterating - it will only pick up the (first/last?) iteration. Try running your subjob from a "run if" from the "disponibilite_3g" component, or even the map component.

– Screwtape
Nov 20 '18 at 10:20













ok @Screwtape i try to do this job to extract current filename and identifie the probleme [enter image description here][1] but i still have the name of latest file [enter image description here][2] [enter image description here][3] [enter image description here][4] [1]: i.stack.imgur.com/FFjk3.png [2]: i.stack.imgur.com/Ia6RW.png [3]: i.stack.imgur.com/wi3bW.png [4]: i.stack.imgur.com/ETqOu.png

– huda tt
Nov 20 '18 at 12:44





ok @Screwtape i try to do this job to extract current filename and identifie the probleme [enter image description here][1] but i still have the name of latest file [enter image description here][2] [enter image description here][3] [enter image description here][4] [1]: i.stack.imgur.com/FFjk3.png [2]: i.stack.imgur.com/Ia6RW.png [3]: i.stack.imgur.com/wi3bW.png [4]: i.stack.imgur.com/ETqOu.png

– huda tt
Nov 20 '18 at 12:44












2 Answers
2






active

oldest

votes


















0














enter image description here



thank you @Screwtape I link your second subjob from the disponsibilite_3G component



but i have the following error






share|improve this answer
























  • Hi! The way in which we would normally use Stack Overflow would be that this post would have been a comment on my answer, rather than another answer. I can't see what has caused your null-pointer exception without seeing a lot of detail from your project. Can you show a picture of your project as you have it now, and I'll see if I can guess where the issue is.

    – Screwtape
    Nov 20 '18 at 16:06



















0














I think the issue you have is that your "RunIf" link is before the iterator, and therefore it's not being triggered at the right time.



The image below shows a simplified version, where I list the rows in the spreadsheets and then the file names. If I connected the second subjob to the tFileList_1 component, as you did in the question, I only get the logs from tLogRow_1 and the last filename by tLogRow_2.



Talend Job Example



With the link as shown, behind the iterator, then I get spreadsheet contents listed and then the title of it:



Col1|Col2|Col3
A|B|C
D|E|F
A.xlsx
Col1|Col2|Col3
A|B|C
D|E|F
B.xlsx
Col1|Col2|Col3
A|B|C
D|E|F
C.xlsx


I am assuming that you have filted out the duplicated files in the tMap component, so if you link your second subjob from the disponsibilite_3d component, I think you will get the result you are looking for.






share|improve this answer


























  • thank you @Screwtape but witch i want is to get only the name of file used in the job (disponibilite_3G in this case ) to save it into a table mysql and not names of all directory files any help please

    – huda tt
    Nov 21 '18 at 13:59













  • Does your tMap filter the files that aren’t used, so that it only gets to the database update when the file hasn’t already been used?

    – Screwtape
    Nov 21 '18 at 14:02











  • yes that's which i want , this filter in the tfilelist i don't know how i can do it , sorry but i am beginner in talend

    – huda tt
    Nov 21 '18 at 14:06











  • I try to select the file names of the DB table with tmysqlinput and then compare the value with the current file name to check if it does not exist already does not exist already

    – huda tt
    Nov 21 '18 at 14:13











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53383836%2ftalend-get-current-filename%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














enter image description here



thank you @Screwtape I link your second subjob from the disponsibilite_3G component



but i have the following error






share|improve this answer
























  • Hi! The way in which we would normally use Stack Overflow would be that this post would have been a comment on my answer, rather than another answer. I can't see what has caused your null-pointer exception without seeing a lot of detail from your project. Can you show a picture of your project as you have it now, and I'll see if I can guess where the issue is.

    – Screwtape
    Nov 20 '18 at 16:06
















0














enter image description here



thank you @Screwtape I link your second subjob from the disponsibilite_3G component



but i have the following error






share|improve this answer
























  • Hi! The way in which we would normally use Stack Overflow would be that this post would have been a comment on my answer, rather than another answer. I can't see what has caused your null-pointer exception without seeing a lot of detail from your project. Can you show a picture of your project as you have it now, and I'll see if I can guess where the issue is.

    – Screwtape
    Nov 20 '18 at 16:06














0












0








0







enter image description here



thank you @Screwtape I link your second subjob from the disponsibilite_3G component



but i have the following error






share|improve this answer













enter image description here



thank you @Screwtape I link your second subjob from the disponsibilite_3G component



but i have the following error







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 20 '18 at 14:12









huda tthuda tt

1




1













  • Hi! The way in which we would normally use Stack Overflow would be that this post would have been a comment on my answer, rather than another answer. I can't see what has caused your null-pointer exception without seeing a lot of detail from your project. Can you show a picture of your project as you have it now, and I'll see if I can guess where the issue is.

    – Screwtape
    Nov 20 '18 at 16:06



















  • Hi! The way in which we would normally use Stack Overflow would be that this post would have been a comment on my answer, rather than another answer. I can't see what has caused your null-pointer exception without seeing a lot of detail from your project. Can you show a picture of your project as you have it now, and I'll see if I can guess where the issue is.

    – Screwtape
    Nov 20 '18 at 16:06

















Hi! The way in which we would normally use Stack Overflow would be that this post would have been a comment on my answer, rather than another answer. I can't see what has caused your null-pointer exception without seeing a lot of detail from your project. Can you show a picture of your project as you have it now, and I'll see if I can guess where the issue is.

– Screwtape
Nov 20 '18 at 16:06





Hi! The way in which we would normally use Stack Overflow would be that this post would have been a comment on my answer, rather than another answer. I can't see what has caused your null-pointer exception without seeing a lot of detail from your project. Can you show a picture of your project as you have it now, and I'll see if I can guess where the issue is.

– Screwtape
Nov 20 '18 at 16:06













0














I think the issue you have is that your "RunIf" link is before the iterator, and therefore it's not being triggered at the right time.



The image below shows a simplified version, where I list the rows in the spreadsheets and then the file names. If I connected the second subjob to the tFileList_1 component, as you did in the question, I only get the logs from tLogRow_1 and the last filename by tLogRow_2.



Talend Job Example



With the link as shown, behind the iterator, then I get spreadsheet contents listed and then the title of it:



Col1|Col2|Col3
A|B|C
D|E|F
A.xlsx
Col1|Col2|Col3
A|B|C
D|E|F
B.xlsx
Col1|Col2|Col3
A|B|C
D|E|F
C.xlsx


I am assuming that you have filted out the duplicated files in the tMap component, so if you link your second subjob from the disponsibilite_3d component, I think you will get the result you are looking for.






share|improve this answer


























  • thank you @Screwtape but witch i want is to get only the name of file used in the job (disponibilite_3G in this case ) to save it into a table mysql and not names of all directory files any help please

    – huda tt
    Nov 21 '18 at 13:59













  • Does your tMap filter the files that aren’t used, so that it only gets to the database update when the file hasn’t already been used?

    – Screwtape
    Nov 21 '18 at 14:02











  • yes that's which i want , this filter in the tfilelist i don't know how i can do it , sorry but i am beginner in talend

    – huda tt
    Nov 21 '18 at 14:06











  • I try to select the file names of the DB table with tmysqlinput and then compare the value with the current file name to check if it does not exist already does not exist already

    – huda tt
    Nov 21 '18 at 14:13
















0














I think the issue you have is that your "RunIf" link is before the iterator, and therefore it's not being triggered at the right time.



The image below shows a simplified version, where I list the rows in the spreadsheets and then the file names. If I connected the second subjob to the tFileList_1 component, as you did in the question, I only get the logs from tLogRow_1 and the last filename by tLogRow_2.



Talend Job Example



With the link as shown, behind the iterator, then I get spreadsheet contents listed and then the title of it:



Col1|Col2|Col3
A|B|C
D|E|F
A.xlsx
Col1|Col2|Col3
A|B|C
D|E|F
B.xlsx
Col1|Col2|Col3
A|B|C
D|E|F
C.xlsx


I am assuming that you have filted out the duplicated files in the tMap component, so if you link your second subjob from the disponsibilite_3d component, I think you will get the result you are looking for.






share|improve this answer


























  • thank you @Screwtape but witch i want is to get only the name of file used in the job (disponibilite_3G in this case ) to save it into a table mysql and not names of all directory files any help please

    – huda tt
    Nov 21 '18 at 13:59













  • Does your tMap filter the files that aren’t used, so that it only gets to the database update when the file hasn’t already been used?

    – Screwtape
    Nov 21 '18 at 14:02











  • yes that's which i want , this filter in the tfilelist i don't know how i can do it , sorry but i am beginner in talend

    – huda tt
    Nov 21 '18 at 14:06











  • I try to select the file names of the DB table with tmysqlinput and then compare the value with the current file name to check if it does not exist already does not exist already

    – huda tt
    Nov 21 '18 at 14:13














0












0








0







I think the issue you have is that your "RunIf" link is before the iterator, and therefore it's not being triggered at the right time.



The image below shows a simplified version, where I list the rows in the spreadsheets and then the file names. If I connected the second subjob to the tFileList_1 component, as you did in the question, I only get the logs from tLogRow_1 and the last filename by tLogRow_2.



Talend Job Example



With the link as shown, behind the iterator, then I get spreadsheet contents listed and then the title of it:



Col1|Col2|Col3
A|B|C
D|E|F
A.xlsx
Col1|Col2|Col3
A|B|C
D|E|F
B.xlsx
Col1|Col2|Col3
A|B|C
D|E|F
C.xlsx


I am assuming that you have filted out the duplicated files in the tMap component, so if you link your second subjob from the disponsibilite_3d component, I think you will get the result you are looking for.






share|improve this answer















I think the issue you have is that your "RunIf" link is before the iterator, and therefore it's not being triggered at the right time.



The image below shows a simplified version, where I list the rows in the spreadsheets and then the file names. If I connected the second subjob to the tFileList_1 component, as you did in the question, I only get the logs from tLogRow_1 and the last filename by tLogRow_2.



Talend Job Example



With the link as shown, behind the iterator, then I get spreadsheet contents listed and then the title of it:



Col1|Col2|Col3
A|B|C
D|E|F
A.xlsx
Col1|Col2|Col3
A|B|C
D|E|F
B.xlsx
Col1|Col2|Col3
A|B|C
D|E|F
C.xlsx


I am assuming that you have filted out the duplicated files in the tMap component, so if you link your second subjob from the disponsibilite_3d component, I think you will get the result you are looking for.







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 21 '18 at 13:29

























answered Nov 20 '18 at 13:24









ScrewtapeScrewtape

507315




507315













  • thank you @Screwtape but witch i want is to get only the name of file used in the job (disponibilite_3G in this case ) to save it into a table mysql and not names of all directory files any help please

    – huda tt
    Nov 21 '18 at 13:59













  • Does your tMap filter the files that aren’t used, so that it only gets to the database update when the file hasn’t already been used?

    – Screwtape
    Nov 21 '18 at 14:02











  • yes that's which i want , this filter in the tfilelist i don't know how i can do it , sorry but i am beginner in talend

    – huda tt
    Nov 21 '18 at 14:06











  • I try to select the file names of the DB table with tmysqlinput and then compare the value with the current file name to check if it does not exist already does not exist already

    – huda tt
    Nov 21 '18 at 14:13



















  • thank you @Screwtape but witch i want is to get only the name of file used in the job (disponibilite_3G in this case ) to save it into a table mysql and not names of all directory files any help please

    – huda tt
    Nov 21 '18 at 13:59













  • Does your tMap filter the files that aren’t used, so that it only gets to the database update when the file hasn’t already been used?

    – Screwtape
    Nov 21 '18 at 14:02











  • yes that's which i want , this filter in the tfilelist i don't know how i can do it , sorry but i am beginner in talend

    – huda tt
    Nov 21 '18 at 14:06











  • I try to select the file names of the DB table with tmysqlinput and then compare the value with the current file name to check if it does not exist already does not exist already

    – huda tt
    Nov 21 '18 at 14:13

















thank you @Screwtape but witch i want is to get only the name of file used in the job (disponibilite_3G in this case ) to save it into a table mysql and not names of all directory files any help please

– huda tt
Nov 21 '18 at 13:59







thank you @Screwtape but witch i want is to get only the name of file used in the job (disponibilite_3G in this case ) to save it into a table mysql and not names of all directory files any help please

– huda tt
Nov 21 '18 at 13:59















Does your tMap filter the files that aren’t used, so that it only gets to the database update when the file hasn’t already been used?

– Screwtape
Nov 21 '18 at 14:02





Does your tMap filter the files that aren’t used, so that it only gets to the database update when the file hasn’t already been used?

– Screwtape
Nov 21 '18 at 14:02













yes that's which i want , this filter in the tfilelist i don't know how i can do it , sorry but i am beginner in talend

– huda tt
Nov 21 '18 at 14:06





yes that's which i want , this filter in the tfilelist i don't know how i can do it , sorry but i am beginner in talend

– huda tt
Nov 21 '18 at 14:06













I try to select the file names of the DB table with tmysqlinput and then compare the value with the current file name to check if it does not exist already does not exist already

– huda tt
Nov 21 '18 at 14:13





I try to select the file names of the DB table with tmysqlinput and then compare the value with the current file name to check if it does not exist already does not exist already

– huda tt
Nov 21 '18 at 14:13


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53383836%2ftalend-get-current-filename%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

MongoDB - Not Authorized To Execute Command

How to fix TextFormField cause rebuild widget in Flutter

in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith