Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Partner
Partner

Min/Max using Fieldvalue and fieldvaluecount with rowno

Im trying to understand the min and max using fieldvalue and fieldvaluecount

 

Names:

LOAD * inline [

"First name"|"Last name"|Initials|"Has cellphone"|Value

John|Anderson|JA|Yes|5

Sue|Brown|SB|Yes|7

Mark|Carr|MC |No|9

Peter|Devonshire|PD|No|11

Jane|Elliot|JE|Yes|13

Peter|Franc|PF|Yes|23 ] (delimiter is '|');

let x = FieldValue('Value',2);

trace $(x);

max:
load
min(Value) as min,
max(Value) as max;
Load
FieldValue('Valor',RecNo()) as Value,
RecNo() as i,
rowno() as j
AutoGenerate FieldValueCount('Value');

 

If I change the recno for rowno in this line: FieldValue('Valor',RecNo()) as Value,

the min and max doesnt work. But the tables loaded with columns i and j are the same with recno or rowno

 

does anyone have a clue?

 

thanks in advance

 

1 Solution

Accepted Solutions
MVP & Luminary
MVP & Luminary

Re: Min/Max using Fieldvalue and fieldvaluecount with rowno

Some clues, so let's call this an educated guess. The RecNo() function returns the record number of the source table. So that number definitely exists when that source record is processed. The RowNo() function returns the number of the record that's created in the target table. My guess is that the FieldValue function is executed just before the record in the target table actually exists and therefore the RowNo() can't return the value of that record yet. That would explain why RecordNo() works and RowNo() doesn't in this case.


talk is cheap, supply exceeds demand
3 Replies
MVP & Luminary
MVP & Luminary

Re: Min/Max using Fieldvalue and fieldvaluecount with rowno

Some clues, so let's call this an educated guess. The RecNo() function returns the record number of the source table. So that number definitely exists when that source record is processed. The RowNo() function returns the number of the record that's created in the target table. My guess is that the FieldValue function is executed just before the record in the target table actually exists and therefore the RowNo() can't return the value of that record yet. That would explain why RecordNo() works and RowNo() doesn't in this case.


talk is cheap, supply exceeds demand
Partner
Partner

Re: Min/Max using Fieldvalue and fieldvaluecount with rowno

it makes sense

but if you comment the min and max table, these tables are equal if you run with recno or rowno:

max:
Load
FieldValue('Valor',RecNo()) as Value,
RecNo() as i,
rowno() as j
AutoGenerate FieldValueCount('Value');

thank you for your time

 

MVP & Luminary
MVP & Luminary

Re: Min/Max using Fieldvalue and fieldvaluecount with rowno

Yes, because then the records end up in the target table instead of being pushed up into the preceding load which processes the records first before they finally end up in the target table.


talk is cheap, supply exceeds demand