Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Adding RecNo() into Table

Good morning QV Experts!

I'm trying to find in which order records are loaded into table by using "RecNo()".

When I put "RecNo()" as comment I have about 5000 rows which is correct.

Base:

load

ListNr,

OrderPoItem,

Planned_Res,

PO_DeliveryDate

//RecNo()  <-- as comment

Resident MDTB

Order By ListNr asc,ListPos asc;

When I delete comment I have over 22 milions rows which is not correct.

Base:

load

ListNr,

OrderPoItem,

Planned_Res,

PO_DeliveryDate,

RecNo()

Resident MDTB

Order By ListNr asc,ListPos asc;

drop Table MDTB;

Do you know why numbers of rows increased?

Thanks in advence!

7 Replies
Miguel_Angel_Baeyens

Not sure what you mean by number of rows increased, a RESIDENT load will take, if there is no WHERE clause of any type, all the rows from the previous table.

Do the Base and MDTB have the same fields? If so, the RESIDENT load is incrementing the rows in the MDTB table, and the Base table will be automatically concatenated to the previous one (MDTB). Maybe that's why the number increases?

Also, if you are using RecNo() without "AS" in any other table, which is technically possible, you are associating those two tables.

See about RecNo() and RowNo() here https://help.qlik.com/en-US/qlikview/November2017/Subsystems/Client/Content/Scripting/CounterFunctio...

captain89
Creator
Creator

Hi,

you had probably made a bad join with synthetic key that duplicates your rows.

Try using the "AS" clause as Miguel suggests.

MarcoWedel

where do you read the number of rows 5000 vs. 22million from (table viewer / status bar)?

Anonymous
Not applicable
Author

Hi,

There, after loading script and insert table.

Untitled.jpg

Anonymous
Not applicable
Author

Thanks Miguel,

As you said, synthetic key caused that issue.

Problem solved.

Anonymous
Not applicable
Author

Thanks Miguel,

As you said, synthetic key caused that issue.

Problem solved.

Miguel_Angel_Baeyens

Glad it worked. Thanks for letting us know