Hitachi Vantara Pentaho Community Forums
Results 1 to 5 of 5

Thread: How to adjust a delivery date?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2013
    Posts
    382

    Default How to adjust a delivery date?

    I was trying to find a simple way to do a simple calc but unable to find anything easy! I came up with quite complex manipulations for such simple problem:

    Our rows contains a date and seven week-of-day boolean flags. We would like to adjust the date to the next (or same) week-of-day with true flag.

    (Maybe it's too early in the morning and I'm still sleepy! )

    Edited: currently I am at a CALC + FORMULA + CALC steps solution ... anything better?
    Last edited by DepButi; 11-09-2017 at 06:19 AM.

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

    Default

    Simple problem, you say?

    Well, it's a mapping of a Date (prevDate) to a Date (nextDate) governed by some rules.
    As such it is a computational simple problem, I agree.
    A simple dataflow graph will result if we use some scripting step.
    I know we can write a mapping function in Java or JavaScript.

    But how would a dataflow solution look alike?
    My idea is to create two sequences, one for the candi-dates and one for the control data.
    There's room for improvement I'm sure.
    Attached Files Attached Files
    So long, and thanks for all the fish.

  3. #3
    Join Date
    Nov 2013
    Posts
    382

    Default

    We ended up with a quite simpler dataflow ...

    Week2 is used to be able to issue a mail message in case there is no valid data.
    Attached Files Attached Files

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

    Default

    You definitely improved on the number of steps involved.


    PS: When concatenating those weeks, you better use [week]&[week2], and not [week2]&[week2]

    Name:  230447.png
Views: 45
Size:  2.9 KB

    BTW: week2 is mainly necessary to avoid string rotation ...
    Last edited by marabu; 11-13-2017 at 06:56 AM.

  5. #5
    Join Date
    Nov 2013
    Posts
    382

    Default

    Nope. If there is no valid date (all booleans false) I don't want to modify the original date, so [week2]&[week2] is the correct way to do it.

    I just need to keep the value of [week] to test it in the next step and send a warning email to someone in case its value is '0000000'. Otherwise I would not need it.

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.