Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Checking to see if the data is text or a number in peek

Hi

Is there a way when using the peek function to check whether the field before it is text or a number? I have an excel file where the data has been placed in such a way that the first column has the person's name in it and then underneath it is the data relating to that person. I would like to be able to assign that person's name to the data without cutting and pasting to change the excel files layout before loading. Is that possible?

Thanks

e.g.

Client
Jensen Button
54678
23564
78654
Adam Eve
23456
56745
98756
3 Replies
anbu1984
Master III
Master III

LOAD Txt As Data,If(Num(Txt) > 0,Peek(Txt),Txt) As Txt Inline [

Txt

Jensen Button

54678

23564

78654

Adam Eve

23456

56745

98756];

MarcoWedel

Hi,

one solution might be:

table1:

LOAD If(IsText(Client),Client,Peek(Client)) as Client,

    Client as Data

FROM [http://community.qlik.com/thread/136009] (html, codepage is 1252, embedded labels, table is @1);

Right Join

LOAD Distinct Data

Resident table1

Where IsNum(Data);

QlikCommunity_Thread_136009_Pic1.JPG.jpg

hope this helps

regards

Marco

MarcoWedel

or even shorter:

LOAD If(IsText(Previous(Client)),Previous(Client),Peek(Client)) as Client,

    Client as Data

FROM [http://community.qlik.com/thread/136009] (html, codepage is 1252, embedded labels, table is @1)

Where IsNum(Client);

QlikCommunity_Thread_136009_Pic1.JPG.jpg

hope this helps

regards

Marco