2 Replies Latest reply: Oct 10, 2011 7:28 AM by Donald Posthuma RSS

    Mapping load with 1 key for two fields

    Donald Posthuma

      Hi all,

       

      I have the following problem. I need to check wether a shipment is delivered within a certain timeframe (defined with a start and endtime) at a depot. The key for these depots are the day and the depot name. However for certain depots I have 2 timeframes for a day. Now I need a way to check for both time frames if the shipment is delivered within the time frame. Any help is greatly appreciated!

        • Mapping load with 1 key for two fields
          Vincent Ardiet

          Hi,

           

          Instead of a mapping load, have you try to join your shipment table with your depot table with IntervalMatch (using the extended syntax) ?

           

          Considering that:

          - Shipments and TimeFrames are loaded

          - Shipments contains at least DepotName and DeliveredTime

          - TimeFrames contains DepotName, Start and End

          - TimeFrames can contain many lines with the same depot name

           

          You will have a script like this:

           

          Left Join (Shipments)

          IntervalMatch (DeliveredTime, DepotName)

          Load

            Start,

            End,

            Depot

          Resident TimeFrames ;


          Drop Table TimeFrames ;

           

          Then, Shipments table will have two more fields Start and End. You can use those fields to create a flag if you don't want to keep them.

           

          Regards,

          Vincent