Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Adding a field to a table

I have a table. For the sake of example, let's say it's created like so:

MyTable:

LOAD Myfield1, Myfield2, Myfield3

RESIDENT SomeOtherTable;

I wanted to add a sequential record number to the table, so I tried this:le:

MyNewTable:

LOAD *, RECNO() as RecordID

RESIDENT MyTable;

It added the RecordID field, but it used seemingly random values - 4, 8, 11, 15 instead of the expected 1,2,3,4.

In order to get the desired result, I had to do this:

MyNewTable:

LOAD Myfield1, Myfield2, Myfield3, RECNO() as RecordID

RESIDENT MyTable;

I consider this to be a bug (among the many other bugs your product has). Oh wait, the trainer refused to call stuff like this a "bug", preferring instead to call it a "nuance".

4 Replies
Anonymous
Not applicable
Author

Use Rowno() instead of RECNo()

sunny_talwar

Is there a where statement when you did a resident load??

What do you get when you use RowNo() instead of RecNo()?

MyNewTable:

LOAD *, RowNo() as RecordID

RESIDENT MyTable;

vikramv
Creator III
Creator III

Try using the rowno() instead of record number.

RecNo or RowNo?

MarcoWedel

Hi,

do you have a sample application+data to demonstrate the issue?

This example doesn't seem to show this behaviour:

QlikCommunity_Thread_226020_Pic1.JPG

MyTable:

LOAD RecNo() as Myfield1,

    Ceil(Rand()*100) as Myfield2,

    Ceil(Rand()*100) as Myfield3

AutoGenerate 20;

MyNewTable:

LOAD *, RECNO() as RecordID

RESIDENT MyTable;

DROP Table MyTable;

thanks

regards

Marco