Hitachi Vantara Pentaho Community Forums
Results 1 to 7 of 7

Thread: Transformation Mail with wildcard issue

  1. #1
    Join Date
    Aug 2011
    Posts
    236

    Question Transformation Mail with wildcard issue

    Hi,

    I am trying to send a email with multiple file attachments but I cannot seem to get the config right.

    I have filled in the filename/folder name with the file directory path and in the wildcard I have 'qc_.*\.txt' to get all txt files beginning with 'qc_' to be attached to the email but the job just seems to hang when it gets to the mail step.

    I have done some googling with no luck and also looking in the forum (although i feel the search functionality is not great).

    Any ideas??

    Thanks in advance.

  2. #2
    Join Date
    Jun 2007
    Posts
    260

    Default

    What does the logs say?

  3. #3
    Join Date
    Oct 2011
    Posts
    5

    Default

    Hi,
    I seem to have related problem.
    The wildcard field does not seem to be working when I set the filename/folder to a file the file is recognized and send.
    But when I set it to the folder I always get all files in that folder emailed and does not matter what I set the Wildcard to ....
    Looks like a bug to me .... or I must be missing something.
    How do I go about fixing it?

  4. #4
    Join Date
    May 2010
    Posts
    5

    Question Mail Transformation Step

    I'm also stating the same. I tried many ways to specify "Dynamic filenames" and none worked. The folder is set in a stream field that is passed to the "Filename Field" and the filename wildcard is contained in a second stream field that is passed to the "Wildcard field".

    If I set it manually to the static "Filename/Foldername" + "Wildcard" field, it works. My folder expression is a folder without blanks, Unix style, and ends with (tried without, too) a slash. My Wildcard expression is simply '.*'.

    It seems to me that the fields are ignored. I tried many variants, even changed the path expression to something like '\/home\/users\/...' - did not work. I suppose, it could be a bug?

  5. #5
    Join Date
    May 2010
    Posts
    5

    Default

    I have now tried many other options and was even looking at the source code. I did not find out, where the problem is. Here again a description of dynamic file name plus wildcard tests:

    As stated in the documentation for the filename field in the Attached Files Tab: «This can also be a folder name, in which case you would use the Wildcard field to determine filenames.» Following this, I added a field that contains a folder in /this/is/my/folder/ notation and a pattern with this schema: '.*4711.*' that should search a file that contains the number '4711' in the file name. The files themselves look like 'abc-<NUMBER>-def.xls' where <NUMBER> is a number, e.g. 4711.

    As I could see in the source code, there is a method, GetFileWildcard(String selectedfile, String wildcard), that is called from the private class' TextFileSelector method includeFile(FileSelectInfo info). This class is used in the method setAttachedFilesList(Object[] r,LogWriter log).

    The GetFileWildcard has a selectedfile parameter - I suppose it contains a single file from the folder listing. It has also a wildcard parameter and I suppose that the value given to the method is wrong (= not the one given in the step dialog window, Attached Files tab).

    Now the first special thing that I saw is, that if the pattern fails to create (having e.g. a syntax error), the GetFileWildcard method will return true. This may be not a problem, but introduces in my opinion a strange behaviour. It may be better to throw an Exception here.

    I rather think that the method setAttachedFilesList(..) has an error in the case where the attached files are not zip files. I do not know, what the call "data.previousRowMeta.getString(r,data.indexOfSourceWildcard);" really does, but I suppose, it loads something wrong. Then after this, the creation of the pattern fails and GetFileWildcard returns true. Hence, all files are selected.

    The only way that worked, was leaving the wildcard empty and putting the full path/file name (without wildcards) in the Filename Field. This is better than nothing, but reduces flexibility strongly.

    There was NO way, to find a workaround including Path + Pattern. Maybe I make a big mistake - I studied Pattern and Matcher as well as the source code, as far that was possible to me - I did not find one. If one of you have the source code loaded and ready to debug, it would be really great if one could find the bug. I mean, following the posts, the problem seems to be open since 2010.

  6. #6
    Join Date
    Aug 2011
    Posts
    2

    Default

    I noticed a bug in the send mail component when using dynamic filenames set to true.
    Even tho I supplied a filename field and a wildcard field it refuses to use these values untill i had input 'dummy' values into the filename/foldername input box and the 'Wild Card' inputbox even tho the full path was already being specified.
    I just put the values 111 and 222 into these boxs and it magically starting using the values set in the filename field and wildcard field.

    Hope this helps.

    an example of my filter
    var attachment_filenames;
    attachment_filenames = '.*[_]Report[_]'+ supplier_id +'[_]'+master_job_id+ '[.]pdf';

    to send files called
    somefilename_report_11111_22222.pdf

  7. #7
    Join Date
    Apr 2008
    Posts
    1,771

    Default

    Hi Robin,
    if you think it's a bug or unexpected behaviour you can create a bug report on Jira.
    http://jira.pentaho.com/secure/Dashboard.jspa

    Mick

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.