3 Replies Latest reply: Feb 23, 2016 6:50 AM by Sunny Talwar RSS

    Trim function

    Trapti Gaharwar

      Hi,

       

      Can anybody will help me to understand below given script pls.

       

       

      upper(if(left(TRIM([Ship to party]),1)='N',[Ship to party Name],'Direct_Sale')) as WH,

        trim([Actual GI date]) as Day,

        left(trim([Actual GI date]),2)*1 as Date,

        right(trim([Actual GI date]),7)*1 as Month,

        if(left([Ship to party],1)='N',[Ship to party Name],[Plant Name]) as [Reciving palnt]

      FROM *_ZSD_0047.XLS (biff, header is 6 lines, embedded labels, table is [zsd_0047$])

      WHERE(IsNum(Delivery));

        • Re: Trim function
          Sunny Talwar

          Are you wondering why the script might be using the Trim Function? I think the data might contain white spaces before or after the actual values which can be used using Trim function here. With regards to the specific code:

           

          upper(if(left(TRIM([Ship to party]),1)='N',[Ship to party Name],'Direct_Sale')) as WH, 

          Checking if the first letter of [Ship to party] field is N, if it is assign the value to a new field called WH the value from the field [Ship to part Name], else call is Direct_Sale.

           

          Do you need the same explanation for all the lines of code or do you get an idea of where I am going?