Skip to main content
Announcements
Jan 15, Trends 2025! Get expert guidance to thrive post-AI with After AI: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
evan_kurowski
Specialist
Specialist

Why does adding RecNo() as a row identifier change the field values

Can anyone explain how the attached application is showing a different set of distinct values for the [Restaurant] and [Menu Item] fields when in the script a RecNo() function is added as an additional field to the data model? It seems to be producing different value lists, because one minute it is MickeyDs and Burger King, and the next minute it is Rainforest Café and Wendy's.

results_w_no_recno.pngresults_w_recno.png

2 Replies
its_anandrjs

Same name of fields you have two fields like for  Restaurant and Menu Item thats why its showing double.

evan_kurowski
Specialist
Specialist
Author

Hello anand, I think you are correct with part of it, the repeating fields seem to have an impact.  However, my question was more related as to why/where the placement of RecNo() in the script seems to be changing the output.

If RecNo() appears in the first statement, does it reference the first of many repeating fields?  If the RecNo() is in a later statement does it reference the last of repeating fields?  Is there a way to reference specifically which instance of a repeating field if there are multiples? For example I'm thinking of a QVD that is extremely wide, perhaps hundreds of fields, and if not loaded via wildcard (*), it could escape notice that there's a repeating set embedded deeper into the field listing.

Take a look at the two script samples below, when I run them against my target .QVD, I get two different results in the .QVW user interface despite the row counts being the same, and the scripting sytnax being practically identical.

//Version 1 - RecNo() appears in second statement
[Restaurant]:
LOAD [Menu Item],    
Restaurant FROM [Menu.QVD] (qvd);

CONCATENATE
LOAD Recno() AS ROW_ID, [Menu Item],    
Restaurant FROM [Menu.QVD](qvd);

//Version 2 - RecNo() appears in first statement
[Restaurant]:
LOAD     Recno() AS ROW_ID,   
[Menu Item],    
Restaurant FROM [Menu.QVD] (qvd);

CONCATENATE
LOAD [Menu Item],    
Restaurant FROM [Menu.QVD](qvd);