1 Reply Latest reply: Sep 23, 2016 2:39 PM by Michael Tarallo RSS

    Variables in Join

    Christopher Ellis

      Could anyone explain the syntax to replace a table name with a variable after the join statement.




      Sub One(A)

          Join (A)

             Load *

          Resident Table2;

      End Sub


      Call One(A)


      Many Thanks



        • Re: Variables in Join
          Michael Tarallo

          Hello Christopher,


          SET vFileName = smart_orders.xls;
              [OrderID] AS [OrderID],
              [OrderDate] AS [OrderDate],
              [CustomerID] AS [CustomerID-CustomerNumber],
              [EmployeeID] AS [EmployeeID],
              [ShipperID] AS [ShipperID],
              [ProductID] AS [ProductID],
              [Sales] AS [Sales],
              [COS] AS [COS],
              [GP] AS [GP],
              [Quantity] AS [Quantity],
              [Discount] AS [Discount],
              [Freight] AS [Freight],
              [StatusID] AS [StatusID];
          LOAD [OrderID],
          FROM [lib://AttachedFiles/$(vFileName)]
          (biff, embedded labels, table is Orders$);


          Not the variable declaration: SET vFileName = smart_orders.xls;

          And the usage: $(vFileName)


          You do not always need to include quotes with variables: as both will work in this case:


          SET vFileName = "smart_orders.xls";




          SET vFileName = smart_orders.xls;


          Here is a good article about using quotes written by one of our resident experts:



          Let me know how you do.


          Please mark the appropriate replies as CORRECT / HELPFUL so our team and other members know that your question(s) has been answered to your satisfaction.



          Mike Tarallo