2 Replies Latest reply: Nov 22, 2017 11:02 AM by Sarah Sullivan RSS

    Load Script Question

    greg bedford

      Hi, I am trying to create a App that only pulls in transactional data far one particular product category.  I am not sure how to do this. 
      I am currently pulling in transactional data that includes a productID field.  It is then joined with a product information file using productID.. 
      I want to use Category to determine what transactional data to pull in.  I tried adding a Where Category = 'Sheets' statement but can't seem to get it to work.
      Any suggestions?

      Thanks.


      LOAD

          ProductID,
          "Product Name",
          Category,
          "Sub Category",
          Vendor,

      FROM [lib://QVD (DM) (sleepcountry_qlsrv)/MasterProductTable.qvd]
      (qvd);

       

      LOAD

      "Date",
        NetSales,
           NetUnits,
           OrderID,
           ProductID,

         
      FROM [lib://QVD (DM) (sleepcountry_qlsrv)/BTADelivered2014.qvd]
      (qvd)

      Where Category = 'Sheets';

        • Re: Load Script Question
          Sunny Talwar

          May be try this

           

          LOAD ProductID,

              If(Category = 'Sheets', ProductID) as ProductIDTemp,
              "Product Name",
              Category,
              "Sub Category",
              Vendor,

          FROM [lib://QVD (DM) (sleepcountry_qlsrv)/MasterProductTable.qvd]
          (qvd);

           

          LOAD

          "Date",
            NetSales,
              NetUnits,
              OrderID,
              ProductID,

          FROM [lib://QVD (DM) (sleepcountry_qlsrv)/BTADelivered2014.qvd] (qvd)

          Where Exists(ProductIDTemp, ProductID);

          • Re: Load Script Question
            Sarah Sullivan

            You could try:

             

            Product:

            LOAD

                ProductID,
                "Product Name",
                Category,
                "Sub Category",
                Vendor,

            FROM [lib://QVD (DM) (sleepcountry_qlsrv)/MasterProductTable.qvd]
            (qvd)

            Where Category = 'Sheets';

             

            LEFT KEEP(Product)

            LOAD

            "Date",
              NetSales,
                 NetUnits,
                 OrderID,
                 ProductID   
            FROM [lib://QVD (DM) (sleepcountry_qlsrv)/BTADelivered2014.qvd]
            (qvd)

             

            The "left keep" statement should only keep transactional orders where the product ID is on the Product table, which in this case should be only "Sheets".

             

            Sarah