Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld, June 24-25, 2020. Free virtual event for DI and DA gurus. Register Today
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Specialist II
Specialist II

Add value from the first raw to all raws

Hi guys,

I have a table as follow

ID     Value

1          100

2            -

3            -

How can i create a new field to have the same value(100) for all IDs and my table will look like

ID     Value       New value

1          100          100

2            -             100

3            -             100

Thxs,

Alec

1 Solution

Accepted Solutions
Highlighted

Re: Re: Add value from the first raw to all raws

Hi

Its working for me.. Check file

View solution in original post

4 Replies
Highlighted

Re: Add value from the first raw to all raws

Hi

try like this

Load ID, Value, If(Isnull(Value),Peek('NewValue'), Value) AS NewValue From tablename;

Edit:

or

Load ID, Value, If(Len(Trim(Value))=0,Peek('NewValue'), Value) AS NewValue;

Load * Inline

[

ID , Value

1, 100

2,

3

];

Highlighted
Specialist II
Specialist II

Re: Add value from the first raw to all raws

hi,

It is not working.. I am getting an error..

Syntax error, missing/misplaced ..

Highlighted

Re: Re: Add value from the first raw to all raws

Hi

Its working for me.. Check file

View solution in original post

Highlighted
Partner
Partner

Re: Add value from the first raw to all raws

Hello, For this specific case try:

DataTemp:

LOAD * INLINE [

    ID, Value

    1, 100

    2, -

    3, -

];

Data:

LOAD

  ID

  ,Value

  ,if(RowNo()=1 ,Value,peek(Value,0)) as NewValue 

Resident DataTemp

;

Drop Table DataTemp

;