Jump to content
Server Maintenance This Week. ×

GetNthRecord not reliable


This topic is 4824 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I have filed a bug report on this.

GetNthRecord is completely unreliable, whether used in a script or custom function.

It will return data from the current record, NOT from the Nth record.

This script fails if you do not concatenate the empty string before the call to getNth.

Tests with a recursive custom function also fail.

Set Variable [ $$r; Value:"" ]

Set Variable [ $k; Value:1 ]

Loop

Exit Loop If [ $k > Get(FoundCount) ]

Set Variable [ $$r; Value:List( $$r; "" & GetNthRecord( Zips::city; $k)) ]

Set Variable [ $k; Value:1 + $k ]

End Loop

Link to comment
Share on other sites

Example file. Does it fail for you? Perhaps we will discover plugin dependencies or something?

getNthFail.fp7.zip

I believe this buglet has more to do with the List() function than GetNthRecord().

Mm, don't think so, take a look at the example file, which derives the getNth value outside of the list operation.

Link to comment
Share on other sites

I believe this buglet has more to do with the List() function - or rather all aggregate functions - than GetNthRecord().

Thanks, can you expand on that?

I do see that in the loop script, if I separately capture the value to a variable with a simple getNthRecord and then incorporate the result in the list function, it works OK.

But in the custom function, the value is captured outside the list operation - but still fails.

Link to comment
Share on other sites

I have a much simpler example (attached). It is also more frightening, because up until now I was convinced that dumping GetNthRecord() into a Let() variable first would solve the issue.

It seems the evaluation order is not what one would expect. I doubt they will ever fix this, though, because it would probably take the speed out of all aggregate functions (this last is purely a speculation on my part).

AggregateNthBug.zip

Link to comment
Share on other sites

Well, you need to do something in order to get it to evaluate first. GetAsType(v) is just as good as "" & v or 0 + v.

BTW, here's another fun example: define two fields as =

Let ( 

t = GetNthRecord ( Textfield ; 1 )

;

List ( t ; GetAsText ( t ) )

)





and =




Let ( 

t = GetNthRecord ( Textfield ; 1 )

;

Exact ( t ; GetAsText ( t ) )

)

then scroll through the records.

Link to comment
Share on other sites

This topic is 4824 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.