Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
ali_hijazi
Partner - Master II
Partner - Master II

order by and FieldValue

Hello

I got a table sorted as follows:

Item_id asc, Sale_Date desc

if i preview the table in the table viewer I get first the item id 26 repeated several times depending on the number of transactions

However now I'm applying a loop as follows:

let vRecords = NoOfrows('myTable');

for i=1 to $(vRecords)

     let x = FieldValue('Item_id',$(i))

next

if I debug the script I get the first item to be 3294 which is not 26 as I'm seeing it in the previewer

what could be the problem?

please Advise

I can walk on water when it freezes
1 Solution

Accepted Solutions
swuehl
MVP
MVP

FieldValue will access the internally stored compressed Field with index given by unique value in load order.

That could explain the difference.

Try using peek() function instead:

for i=0 to $(vRecords)-1

     let x = Peek('item_id',$(i),'myTable')

next

Hope this helps,

Stefan

View solution in original post

1 Reply
swuehl
MVP
MVP

FieldValue will access the internally stored compressed Field with index given by unique value in load order.

That could explain the difference.

Try using peek() function instead:

for i=0 to $(vRecords)-1

     let x = Peek('item_id',$(i),'myTable')

next

Hope this helps,

Stefan