Quantcast
Channel: Data Preparation & Blending discussions
Viewing all articles
Browse latest Browse all 4999

Using substring and ltrim in Alteryx

$
0
0

Hi,

 

I have the below sql code and want to convert this to alteryx formula and apply to dataset below.

 

isnull(SUBSTRING(rtrim(ltrim(hhm.Surname)),2,1),'2')
      +isnull(SUBSTRING(rtrim(ltrim(hhm.Surname)),3,1),'2')
      +isnull(SUBSTRING(rtrim(ltrim(hhm.Surname)),5,1),'2')
      +isnull(SUBSTRING(rtrim(ltrim(hhm.forenames)),2,1),'2')
      +isnull(SUBSTRING(rtrim(ltrim(hhm.forenames)),3,1),'2')
      +case when hhm.[Date of Birth] is NULL
            then '00000000'
            else replace(CONVERT(char(10),hhm.[Date of Birth],103),'/','')
       end
      +isnull(case when hhm.Gender = 'M'
            then '1'
            else '2'
       end,'2')                                         as 'Statistical Linkage Key'

 

 

Tenant CodeSurnameForenamesDate of BirthGender
100Annetts                  Karen                         1981-04-12F
101Barood                   Sami                          1991-07-06M

 

Required Field:

 

Tenant CodeStatistical Linkage Key
100nntar120419812
101aroam060719911

 

 

Thanks

Jag


Viewing all articles
Browse latest Browse all 4999

Trending Articles