Skip record on the form

Hello I don’t want to show all the record on the form,It’s depend on my criteria.In the report I use CurrReport.Showoutput = False or CurrReport.skip . How can I skip the record on the form?

Hi mena, You can do that by using source table view property in the form. Example is form 42 and 43.

Hi Ahmed I know how to use source table view property on the form.But my condition isn’t only Document type=Order, My code is about 1 page to check the record that show on the form.Do I have another way to skip the record on run-time? It’s very important.Help me

HI If u have can Filter the records using SETRAGE or SetFilter on OpenForm trigger of the form u r trying to Run. IF u want to filter with date the code will look like SETRANGE(“Date Filter”,0D,WORKDATE - 1); Harikesh

Check the warehouse list forms (warehouse pick list as example). You’ll see a way of doing it ;). Regards,

If its difficult to use Setrange or Source Table view you could always MARK the records that pass you criteria and the filter the table by MARKEDONLY(TRUE) then run the form using this filtered view of the table. Not very elegant but gets round some problems

Hi Mena, What I understand, is that you have a number of very complex conditions to decide whether to show a record or not. You could try the following: In the code in your Form… **OnFindRecord(Which : Text[1024]) : Boolean** exit(find(which) and ShowThisRecord); **OnNextRecord(Steps : Integer) : Integer** *create a local variable* Local Variables Name | DataType ResultSteps | Integer *then add the following code* REPEAT ResultSteps := NEXT(Steps); UNTIL (ResultSteps = 0) OR (ShowThisRecord); EXIT(ResultSteps); Else where create a Function called ShowThisRecord this function should return true if the seleced record is to be shown. What happens is that when the form goes to the next record, it will seek then next record forwards or backwards until it finds a record that is permitted to show. If the form reaches the last record, then it will stop looping. If you do a search, then the form will exit false and not display the record. Good luck.

David, IMHO this posting should go into some FAQ.

Totally agree. I will put it there… thanks for the hint.

Hello David Could you please explain me about OnFindRecord Trigger? – I am not understand how it work.What is find(which)?

Which is the search direction it is either ‘>’ or ‘<’. Basically if you press <CTRL+END> then the trigger will execute a FIND(’+’) command and if you press <CTRL+HOME>, then it will execute a FIND(’-’). To demonstrate try adding this code. **OnFindRecord(Which : Text[1024]) : Boolean** IF Which = '-' THEN EXIT(FIND('+')); IF Which = '+' THEN EXIT(FIND('-')); EXIT(FIND('=><'));whilst rather useless, (it just reverses the function of the <CTRL+END> and <CTRL+HOME> keys), it serves to show how the trigger works. The third option is where WHICH = ‘=><’ in this case Navision executes a FIND(’=><’) command which is called by the OnOpenForm trigger to find the nearest to the last record that was previously opened, or when you use the Find command (+F).

HINT: By the way the if you are trying to prevent users from accessing a particular record, the OnFindRcord part of the code is very important, other wise, if you know the primary key, you can just enter it int he Find box, adn go straight to it without triggering the OnNextRecord code.

quote:


Originally posted by David Singleton REPEAT ResultSteps := NEXT(Steps); UNTIL (ResultSteps = 0) OR (ShowThisRecord); EXIT(ResultSteps);


This is a nice piece of code, but I have a problem I can’t solve. I have a list form and a field where the user enters a filter that the function described above (ShowThisRecord) uses. When the user enters this filter the code above is fired and works nice except for the row the cursor was at when the filter was entered. This row is allways shown even if I don’t want it to.