Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
anuradhaa
Partner - Creator II
Partner - Creator II

Fill column based when exporting data from excel

    ID                    Date                    Boundary

39150479Jan 3, 2013
39150969Jan 3, 2013
33921553Jan 3, 2013
41824919Jan 3, 2013
40506013Jan 7, 2013
41868133Jan 8, 2013Jan 8, 2013
42016041Jan 10, 2013
27636287Jan 10, 2013
39122673Jan 11, 2013
39150663Jan 11, 2013
42275701Jan 11, 2013
39106517Jan 11, 2013
41371309Jan 16, 2013
42840603Jan 20, 2013
42652691Jan 20, 2013
42542235Jan 21, 2013
41880955Jan 21, 2013Jan 21, 2013

I have below data in Excel file. I need to fill the empty cells in boundary column based on below logic when export data to qlikview.

Find is there a value in Boundary. Then fill all the above raws with boundary value until you have a value in boundary.

That means we have to fill first 5 raws with Jan 8, 2013 and other empties with Jan 21, 2013.

Is this possible.

Thank You

1 Solution

Accepted Solutions
sunny_talwar

Try this:

Table:

LOAD If(Len(Trim(Boundary)) = 0, Alt(Peek('Flag'), 1), RangeSum(Peek('Flag'), 1)) as Flag,

  ID,

    Boundary

FROM

testPT.xls

(biff, embedded labels, table is Sheet1$);

FinalTable:

NoConcatenate

LOAD ID,

  If(Len(Trim(Boundary)) = 0, Peek('Boundary'), Boundary) as Boundary

Resident Table

Order By Flag desc, Boundary;

DROP Table Table;

View solution in original post

16 Replies
Chanty4u
MVP
MVP

Chanty4u
MVP
MVP

anuradhaa
Partner - Creator II
Partner - Creator II
Author

It get top raw and fill below cells with that value. but i want to get bottom and fill top cells

sunny_talwar

Try this:

Table:

LOAD @1 as ID,

    @2 as Date,

    @3 as Boundary

FROM

[https://community.qlik.com/thread/199245]

(html, codepage is 1252, no labels, table is @1);

FinalTable:

NoConcatenate

LOAD ID,

  Date,

  If(Len(Trim(Boundary)) = 0, Peek('Boundary'), Boundary) as Boundary

Resident Table

Order By Date desc, Boundary desc;

DROP Table Table;


Capture.PNG


settu_periasamy
Master III
Master III

Hi,

The another way (if is a small file), may be you can use Enable Transformation Tab

Capture.JPG

It will create the script like

LOAD ID,

     Date,

     Boundary

FROM

[..\Book1.xlsx]

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

Replace(3, bottom, StrCnd(null))));

sunny_talwar

Settu‌ you mentioned that if this is a small file. What happens for a bigger database? Is this not a good way to fill data if you have, lets say 10+ million rows?

anuradhaa
Partner - Creator II
Partner - Creator II
Author

Thanks Sunny,

What happen if i need to use attached excel, Use attached qvw also.

Thanks

sunny_talwar

Try this:

Table:

LOAD If(Len(Trim(Boundary)) = 0, Alt(Peek('Flag'), 1), RangeSum(Peek('Flag'), 1)) as Flag,

  ID,

    Boundary

FROM

testPT.xls

(biff, embedded labels, table is Sheet1$);

FinalTable:

NoConcatenate

LOAD ID,

  If(Len(Trim(Boundary)) = 0, Peek('Boundary'), Boundary) as Boundary

Resident Table

Order By Flag desc, Boundary;

DROP Table Table;

settu_periasamy
Master III
Master III

sunindia‌ i did a test after seeing your reply with my 1 lakh qvd data.. but laptop  got hanged.. I'm not sure about the performance..