29 Replies Latest reply: Mar 17, 2017 7:05 AM by Sunny Talwar RSS

    Transform a set expression to an expression in the script

    omar bensalem

      Hi all (stalwar1),

       

      Here is my demand,

       

      I have a list of dates (date_embarquement), and a list of plaques (plaque):

      for each date and plaque: we should only have ONE code_carrier.

       

      In the source, we could find for Code_Ligne = MAR, in a date_embarquement and a plaque something like this:

      Capture.PNG

       

      which is false since It's the same folder (dossier).

       

      Here's the original expression:  count({<Code_Ligne={'MAR'}>}Dossier)

       

      I changed it like this:

      count({<Code_Ligne={'MAR'},

      Dossier={"=Count(Aggr((Code_Carrier&Plaque),Date_Embarquement,Plaque))=1"}>}Dossier)

       

      and the result is: (I think It's a success):

      Capture.PNG

       

       

      Now, the question is; how to implement the previous expression in the script to force it to only bring one code_carrier per date_embarqueent and Plaque for code ligne maroc?

       

      The script is as follow:

       

       

       

      LOAD

         Dossier,

        

         "%Date ID",

          Code_Activite,

          Designation_Activite,

          Sens,

          Filiale_Creation_Dossier,

          "Filiale Origine",

          "Pays Fililale Origine",

          "Filiale Destination",

          Code_Ligne,

         

          Num_Voyage,

          Date_Dossier,

          Date_Embarquement,

          Date_Debarquement,

          Groupe_Complet_Vide,

          Plaque,

          Parc,

          Type_Materiel,

          Compagnie,

          Remorque_Parc_HorsParc,

          Voyage_Ligne,

          Code_Carrier,

          Pays,

          PAYS2,

          Charge_Vide

      FROM [lib://qvd/final_16-03-017.qvd]

      (qvd)

      Where Code_Ligne = 'MAR';

       

      You'll find attached the 2 Qvds I'm working with : (calendar and final)

       

      Thank you,