Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

load last n rows from excel

Hello. I hope someone can help me.I want to load the last n rows from a table in excel.How can i do that?

1 Solution

Accepted Solutions
fernandotoledo
Valued Contributor

load last n rows from excel

You have to load all table first then, use the NoOfRows('table') Function to know how many rows there is in the table and store it in a variable, like

LET a = NoOfRows('tab1');

then load it again with a "where RowNo() > $(A-N)" statement

18 Replies
fernandotoledo
Valued Contributor

load last n rows from excel

You have to load all table first then, use the NoOfRows('table') Function to know how many rows there is in the table and store it in a variable, like

LET a = NoOfRows('tab1');

then load it again with a "where RowNo() > $(A-N)" statement

Not applicable

load last n rows from excel

Thanks for the reply.It seems that there in no way to avoid the first load.

brenner_martina
Valued Contributor II

AW:Re: load last n rows from excel

Hi konstantinos,

do you know how many rows you want to load? You can use the header size with a variable and then load the titleline with the fieldnames to rename all fileds.

Not applicable

AW:Re: load last n rows from excel

Hi Martina,

thanks for the reply.Unfortunately i don't know the number of rows.

brenner_martina
Valued Contributor II

AW:Re: AW:Re: load last n rows from excel

Hi, konstatntinos,

how do you find them out? Did you try the possibilities of Enable Transformation Step? there you can enter conditions to find the right lines to load?!

Not applicable

AW:Re: AW:Re: load last n rows from excel

Hi Martina,

the only condition is that the rows must be the last n in the table. I tried the Transformation step but since the number of rows is not fixed i did n't find something that will do the job on any case.

brenner_martina
Valued Contributor II

AW:Re: AW:Re: AW:Re: load last n rows from excel

Hi, konstantinos,

do you know any condition how many n rows you have to load?

MVP
MVP

load last n rows from excel

Hello Konstantinos,

Maybe not the most beautiful way, but loading the table frist to know the number of rows (I don't know any other way of counting them, but loading it or even -untested- connect via ODBC/OLE DB) then you can use function RecNo() to start loading when RecNo() greater than total rows - n.

Does that suit you?

Not applicable

AW:Re: AW:Re: AW:Re: load last n rows from excel

Hi Martina,

n is a fixed number, e.g n=5. I just need the last 5 records added to a table.

Community Browser