Hitachi Vantara Pentaho Community Forums
Results 1 to 6 of 6

Thread: Condition file exists.

  1. #1
    Join Date
    Sep 2013
    Posts
    2

    Default Condition file exists.

    Dear Mans.

    I am wanting to make a condition to check if the file exists in a directory. If he follows the flow exists, otherwise it aborts.


    I've tried a few ways and could not reach the conclusion because even though it does not exist it follows the flow and does not enter aborts.

    Name:  pdi.jpg
Views: 1050
Size:  20.3 KB

    Thank you.
    Last edited by rpbarros; 09-25-2013 at 02:12 PM.

  2. #2
    Join Date
    Jun 2012
    Posts
    5,534

    Default

    Existence of a file will affect the boolean return value and not trigger error handling.
    "Get File Names" will only return files that exist, so no need for "File Exists" in that case.
    So long, and thanks for all the fish.

  3. #3
    Join Date
    Feb 2011
    Posts
    840

    Default

    I think the kind of thing you're trying to do would be at job-level, not transformation level.
    As marabu said, Get File Names only retrieve existent files - therefore, no need for a "file exists --error--> abort" flow.

    In case of filenames using variables, that you want to check for existence prior to running a transformation, you could do something like this...
    Name:  2013-09-25_17h24_09.png
Views: 1011
Size:  37.7 KB

    Here, first I check for the existence of 4 XLS files I need. Then I check for the existence of one file I'm going to (re)create. If the file already exists, I remove it, and then proceed to recreating it.

    I found that Output steps that create files, like Excel Writer, won't always work as needed on overwrite mode. Sometimes it'll recreate the whole file, sometimes if there's already a file there it'll just re-use it, even with the overwrite setting and a template set. Hence why I decided to "check for file" and "delete files" steps in job-level.
    Join us on IRC! =)

    Twitter / Google+ / Timezone: BRT-BRST
    BI Server & PDI 5.4 / MS SQL 2012 / Learning CDE & CTools
    Windows 8 64-bit / Java 7 (jdk1.8.0_75)

    Quote Originally Posted by gutlez
    PLEASE NOTE: No forum member is going to do your work for you. We will help you sort out how to do a specific part of the work, as best we can, in the timelines that our work will allow us.

    I'm no expert.Take my comments at your own risk.

  4. #4
    Join Date
    Sep 2013
    Posts
    2

    Default

    Quote Originally Posted by marabu View Post
    Existence of a file will affect the boolean return value and not trigger error handling.
    "Get File Names" will only return files that exist, so no need for "File Exists" in that case.



    I left so now.
    Name:  pdi2.jpg
Views: 903
Size:  9.2 KB

    Name:  pdi3.jpg
Views: 903
Size:  21.0 KB


    But I would understand if he does not find the file it will automatically abort or will he continue? If in case it does not exist within the folder as I do for him to understand that he must stop and not follow the process?

    thank you

  5. #5
    Join Date
    Feb 2011
    Posts
    840

    Default

    from the previous shot, you forgot to hop Get Variables to Get File Names

    and yeah, if no files are found on the Get File Names, nothing is passed on to Text file input. I just don't remember right now if nothing happens and it just ends, or if the transformation ends in error.
    Join us on IRC! =)

    Twitter / Google+ / Timezone: BRT-BRST
    BI Server & PDI 5.4 / MS SQL 2012 / Learning CDE & CTools
    Windows 8 64-bit / Java 7 (jdk1.8.0_75)

    Quote Originally Posted by gutlez
    PLEASE NOTE: No forum member is going to do your work for you. We will help you sort out how to do a specific part of the work, as best we can, in the timelines that our work will allow us.

    I'm no expert.Take my comments at your own risk.

  6. #6
    Join Date
    Jun 2012
    Posts
    5,534

    Default

    It's not an error for TFI to read filenames from an empty stream.
    No row just means nothing to do.
    So long, and thanks for all the fish.

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.