Detect Runformview table filter in called form.

Hello, Can anyone tell me how I can detect in a form if it has been run by another form using a tableview (WHERE x=filter(…)) in the runformview property. I have tried xrec.GETFILTERS (and rec.GETFILTERS) in the OnNewRecord trigger in the called form and this does not seem to pick up the table filter that is clearly in effect. (What I am trying to do is ascertain if the old record had a filter. If it does I can give the field in the new record the same value so it will not disappear from veiw because of the tableview that is in effect. And no, I don’t want to remove the filter using setrange in onaftergetrecord like standard functionality.) Thanks for any contributions.

You will need to use de GETFILTER statement. The only thing why it’s not work is course these filters are not in filtergroup no. 0. To change filtergroups do this: record.FILTERGROUP(2); filters := record.GETFILTERS; record.FILTERGROUP(0); Here you have filtergroups explained: Number Name Description 0 Std The default group where filters are placed when no other group has been selected explicitly. This group is used for filters that can be set from the filter dialogs by the end user. This group is also used for the filtering action that is the result of the RunFormLink property on a form. 1 Global Not used, but may be used in the future. 2 Form Used for the filtering actions that result from the SETTABLEVIEW function; from the SourceTableView property; and from the DataItemTableView property. 3 Exec Used for the filtering actions that result from the SubFormView and RunFormView properties. 4 Link Used for the filtering actions that result from the DataItemLink and SubFormLink properties. 5 Temp Not used, but may be used in the future.

This is what you want: OnNewRecord() filtergroup(2); field := getfilter(field); filtergroup(0);

Many Thanks Emiel, You put me in the right direction, but as stated in your first respones it is FILTERGROUP(3) for runformview filters, not FILTERGROUP(2) as in your second response (sorry for splitting hairs!![;)]). (I think there is room for confusion because when using the assist button in the runformview field it opens a window called Tableview, which is what i was reffering to, but this is as I now know different from the C/AL SETTABLEVIEW and property sourcetableview. Just thought I’d add that in!)

Glad I could help. btw, 2 was just a example, that why I copied the help into the post, so you could find the right group yourself :wink: