Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
louisernould
Contributor III
Contributor III

fill transformation for multiple files

hi everybody,

i'm a newbee in Qlikview and I have a problem with the fill transformation.

here it is:

I want to analyse a just some lines in multiples excel files:  I have 50 files with quite the same name (test1.xls, test2.xls,...test50.xls and it is the same architecture in the files) and I want only the 3 first lines. So, I used "where RowNo()<3" at the end. No problem for this.

My problem appears because I have in my fist column one date (date1) for other dates (Date2) and when do the "fill transformation", the final table makes the fill transformation only for the first file and not for the other.

To resume: I have two steps I have to do:

- make a big table with the 3 first lines of multiples excels files

- fill the empty fields with the upper date

for example:

test1.xls

Date1Date2quantity
01/01/201401/01/201410
02/01/201410
03/01/201420

test2.xls

Date1Date2quantity
02/01/201402/01/201410
03/01/201420
04/01/201420

test3.xls

Date1Date2quantity
03/01/201403/01/201420
04/01/201420
05/01/201430

The final Table that qlikview gives me:

Date1Date2quantity
01/01/201401/01/201410
01/01/201402/01/201420
01/01/201403/01/201420
02/01/201402/02/201410
03/01/201403/01/201420

And what I really want:

Date1Date2quantity
01/01/201401/01/201410
01/01/201402/01/201420
01/01/201403/01/201420
02/01/201402/02/201420
02/01/201403/01/201420
02/01/201404/01/201430
03/01/201402/01/201430
03/01/201403/01/201430
03/01/201404/01/201440

My code is:

LOAD

     Date1,

     Date2,

     quantity

    

FROM

(biff, embedded labels, filters( Replace(1, top, StrCnd(null))))

where RowNo()<3;

I really hope it's enough clear, if it's not, don't hesitate, tell me and i will try to be more

I tried a lot of thing but now I don't have more ideas...

Thanks a lot

Louis

1 Solution

Accepted Solutions
MK_QSL
MVP
MVP

While load the files, you can replace Date1 field with below expressions...

If(IsNull(Date1) or Len(Trim(Date1))=0, Peek(Date1), Date1) as Date1,

View solution in original post

10 Replies
MK_QSL
MVP
MVP

While load the files, you can replace Date1 field with below expressions...

If(IsNull(Date1) or Len(Trim(Date1))=0, Peek(Date1), Date1) as Date1,

louisernould
Contributor III
Contributor III
Author

It's not working , its return me the same table.

But I think the problem is coming from the "where" and the "replace". I have the feeling that the qlikview is not doing the loop "replace", it's treating the first excel file ans not the other...

Is it possible to make a loop  with a "for each" ?

MK_QSL
MVP
MVP

Can you provide three four excel file with 10 lines each along with the script you are using?

alexandros17
Partner - Champion III
Partner - Champion III

Try with this code and let me know:

LOAD If(isnull(Date1), if(IsNull(Previous(Date1)), Previous(Previous(Date1)), Previous(Date1)), Date1) as Date1,

     Date2,

     quantity

FROM

AAAA.xlsx

(ooxml, embedded labels, table is Foglio1);

louisernould
Contributor III
Contributor III
Author

Hi Alessandro, it's not working either.

(how can i upload some files ? I have a rar archive ready)

alexandros17
Partner - Champion III
Partner - Champion III

you said your code is:

LOAD

     Date1,

     Date2,

     quantity

   

FROM

(biff, embedded labels, filters( Replace(1, top, StrCnd(null))))

where RowNo()<3;


then transform it in:


LOAD If(isnull(Date1), if(IsNull(Previous(Date1)), Previous(Previous(Date1)), Previous(Date1)), Date1) as Date1,

     Date2,

     quantity

FROM

(biff, embedded labels, filters( Replace(1, top, StrCnd(null))))

where RowNo()<3;

louisernould
Contributor III
Contributor III
Author

Hi !

I followed your advise in a different way: and it worked !!

Actually, when I did it, it didn't work, but I removed "where RowNo()<3", and now I have the totality of the date but the text under the line 3 appears... 😕
And when I put "where..." again, all the good dates disappear (and the text disappear too )

Do you know something else to say the same thing that "where..." ?

this code work but now I have all the field... and I want only 3 lines:

LOAD  If(IsNull(Date1) or Len(Trim(Date1))=0, Peek(Date1), Date1) as Date1,

     Date2,

     Quantity

   

FROM

(biff, embedded labels);

MK_QSL
MVP
MVP

Actually, can you simply attach your excel file rather than .rar... I can't uncompressed it....