Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

kalyandg
Contributor II

Extracting the name

hi all,

i have the following type of data

acctcodeacctnamePL AcclevelsLevel 5Level 4Level 3Level 2Level 1
100000000000000AssetBS1100000000000000100000000000000100000000000000100000000000000100000000000000
110000000FIXED ASSETSBS2100000000000000100000000000000100000000000000100000000000000100000000000000
111000000FIXED ASSETSBS3110000000100000000000000100000000000000100000000000000100000000000000
111010000FIXED ASSETSBS4111000000110000000100000000000000100000000000000100000000000000
111100000LANDBS5111010000111000000110000000100000000000000100000000000000
111100001FREE HOLD LANDBS6111100000111010000111000000110000000100000000000000
111100002LEASE HOLD LANDBS6111100000111010000111000000110000000100000000000000
111200000BUILDINGBS5111010000111000000110000000100000000000000100000000000000
111200001BUILDINGBS6111200000111010000111000000110000000100000000000000

with the acctcode and acctname, i have to extract the name(respective acctname) for Level 1 field, and other 4 levels fields

please help me to get the desired result.

it is do in the script and get names for all level fields.

Thanks in advance,

Kalyan

1 Solution

Accepted Solutions
kalyandg
Contributor II

Re: Extracting the name

hi all,

everybody who refer this discussion....

i have solved it by myself using applymap...

Seg_Map:

Mapping Load Acctcode,

AcctName

From ......

Segment:

Load AcctCode,

       

ApplyMap('SegMap',[Level 1],'N/A') as L1Name,    

     ApplyMap('SegMap',[Level 2],'N/A') as L2Name,

     ApplyMap('SegMap',[Level 3],'N/A') as L3Name,    

     ApplyMap('SegMap',[Level 4],'N/A') as L4Name,

     ApplyMap('SegMap',[Level 5],'N/A') as L5Name

From............

I have extracted names from the AcctName to  the respective Levels successfully..

Thanks,

Kalyan.D

3 Replies
Gabriel
Valued Contributor II

Re: Extracting the name

Hi,

It's not clear from the picture above if the acctcode and acctname are join together.

However, best bet will be to use Subfield()

Example:-

subfield(S, ';' ,2)

returns 'cde' if S is 'abc;cde;efg'

subfield(S, ';' ,1)

returns NULL if S is an empty string

Try Subfield and let us know if it workd.

Regards,

Gabriel

kalyandg
Contributor II

Re: Extracting the name

hi gabriel..

acctcode is seperate...numbers(integer)

acctname is character...

are you able to see the levels(1-5)?

level1 is integer...

but i need level1name by using the acctname...

example:

Load

AcctCode,

AcctName as L1Name

From xxxx

where Level 1 = AcctCode;

whehther this script will be correct or not?

but i cant get exact names by using this scripting

please help

kalyandg
Contributor II

Re: Extracting the name

hi all,

everybody who refer this discussion....

i have solved it by myself using applymap...

Seg_Map:

Mapping Load Acctcode,

AcctName

From ......

Segment:

Load AcctCode,

       

ApplyMap('SegMap',[Level 1],'N/A') as L1Name,    

     ApplyMap('SegMap',[Level 2],'N/A') as L2Name,

     ApplyMap('SegMap',[Level 3],'N/A') as L3Name,    

     ApplyMap('SegMap',[Level 4],'N/A') as L4Name,

     ApplyMap('SegMap',[Level 5],'N/A') as L5Name

From............

I have extracted names from the AcctName to  the respective Levels successfully..

Thanks,

Kalyan.D

Community Browser