4 Replies Latest reply: Apr 12, 2016 10:50 AM by Stefan Wühl RSS

    How can I make this Rand() script work? Trying to assign a Sales Person based on a random ID?

    John Blomqvist

      Hi all,

       

      I have the following piece of script:

       

      Emp:

      LOAD Floor(SalesID) as SalesID, Name INLINE [

          SalesID, Name

          1, Julie

          2, John

          3, David

          4, David R

          5, Teresa,

          0, Michael

      ];

       

       

      Data:

      LOAD

      ApplyMap('Emp', RandNum,'Missing') as SalesPerson,

      *;

      LOAD

           Floor(Rand() * 5) as RandNum,

           <other data>

      FROM datafile.xls;

       

      The output is blank for SalesPerson column:

       

       

      Any idea how to fix this?

       

      The point is to assign a random sales person based on the RandNum field.