Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
adnan_rafiq
Partner - Creator II
Partner - Creator II

Repeating values until null.

Hi everyone.

Just wanted to pick the brains of the gurus of QV. I want to repeat a value in a column that I get in a table using script, as many times until I find a non-null value in the same a column. So for example sake consider (AS-is)

Header 1Header 2
42186AB
CD
WE
TT
RR
QS
EF
42155GH
IJ
KL
SA
AS
QW
MN

I am trying to get, (To Be)

Header 1Header 2
42186AB
42186CD
42186WE
42186TT
42186RR
42186QS
42155GH
42155IJ
42155KL
42155SA
42155
42155

I have tried ALT, PEEK and PREVIOUS but only got values to repeat twice by using PREVIOUS.

Please help

1 Solution

Accepted Solutions
Gysbert_Wassenaar

LOAD if(len(trim([Report number]))=0,Peek([Report number]),[Report number]) as Peekedcolumn,

    Column,

    Numbers

FROM

...

You're peeking in the wrong field. Use peek(Peekedcolumn) or give the resulting field the name [Report number]


talk is cheap, supply exceeds demand

View solution in original post

18 Replies
Gysbert_Wassenaar

LOAD

     If(Len(Trim([Header 1]))>0,[Header 1], Peek([Header 1]) as [Header 1],

     [Header 2]

FROM

     ...

If [Header 1] contains only numbers you could also try Alt([Header 1], peek([Header 1])) as [Header 1]


talk is cheap, supply exceeds demand
tamilarasu
Champion
Champion

You can use fill option in Transformation Wizard.

LOAD [Header 1],

     [Header 2]

FROM

[Sample.xlsx]

(ooxml, embedded labels, table is Sheet1, filters(

Replace(1, top, StrCnd(null))

));

adnan_rafiq
Partner - Creator II
Partner - Creator II
Author

Same result that I had already had the values repeat 1 time and then stop. see here

result.png

Gysbert_Wassenaar

Post your qlikview document and source file.


talk is cheap, supply exceeds demand
Kushal_Chawda

try this


Load *,

         if( len(trim(Header1))=0, peek('Header1_1'),Header1) as Header1_1

FROm Table

adnan_rafiq
Partner - Creator II
Partner - Creator II
Author

I want to do it via script.

adnan_rafiq
Partner - Creator II
Partner - Creator II
Author

see reply above

tamilarasu
Champion
Champion

The above code is load script.!!

Kushal_Chawda

what reply?