Find

Hi ,

Find(’-’) go first----------------- Find(’+’) go last

Is ther anything in navision to write find second record

or find third record …or find fourth record … or find fifth record

I know i can write this coding in indirect way … if there is anything like this please let me know

thank you

Findset;

Next(3);

Hi!

To be a little bit more specific:

  • FIND(‘-’) retreives a result-set (all records in the filtered range) and sets the pointer to the first record from this set.

  • FIND(‘+’) retreives a result-set (all records in the filtered range) and sets the pointer to the last record from this set.

  • IF you want to ONLY retreive the first or last record of a filtered range, then it would be the FINDFIRST or FINDLAST commands.

Regarding your questions: No, there is no command for e.g. getting the 4. record from a set, or something. You have to program it, for example like

Record.SETRANGE(…)
Record.FIND(‘-’)
IF Record.NEXT(3) THEN; // sets pointer 3 steps below, 1 + 3 = 4th record from top

This works also the other way around:

Record.SETRANGE(…)
Record.FIND(‘+’)
IF Record.NEXT(-3) THEN; // sets pointer 3 steps above, 1 + 3 = 4th record from bottom

Hope this helps you.

Regards,

Jörg

Hi David!

You’ve been quicker [:)] But are you sure it will work with FINDFIRST? At least with SQL Server you’ll get a problem; here it should be FINDSET (or FIND(‘-’)) …

Best regards,

Jörg

yes you are right, it shoudl have been findset. (I will edit the post to indicate this.)

It works (and it shouldn’t, it should error out, to force developers to make these decisions correctly), but it’s not the right way.

Hi ,

thanks for you all … i think the 2nd reply will work …thanks again

hi all ,

this the solution …posting it so that we can know the result

rec.FIND(’-’);

IF (rec.NEXT(1)=1) THEN BEGIN //// then the 2nd record { 1 will point you to 2nd record and 2 will point you to 3rd }

BarcodeNo2 := rec.“Barcode No.” ;

END;

rec.FIND(’-’) ;

IF (rec.NEXT(2)=2) THEN BEGIN ////////////////// this is the 3rd record

BarcodeNo3 := rec.“Barcode No.” ;

END;

You can force an error (for any NEXT not based on a set established by a FIND/FINDSET), by setting in SQL:

UPDATE [$ndo$dbproperty] SET diagnostics = 81920

Setting the value to 16384 instead, writes an error entry to the Client Monitor, but does not actually throw an error.