Set property from the code...

Is there any chance to set property from the code in the SourceTableView in the form?

Hi Milosh

No, you can’t change the SourceTable in a form from C/AL code.

Regrads

Claus

There is no real need to ever do this. You need to analyze the need that your client has, and work out how to fullfill that need.

Can you explain rather what you are trying to achieve, rather than how you are planning to do it. Then we can help you to acheive the goal.

Well, as stated in the other posts, you can’t set the TableView property, but you can define the View of a Form via C/AL code like this:

MyRecord.SETCURRENTKEY(…);
MyRecord.SETRANGE(Field01, …);
MyRecord.SETFILTER(Field01, …);
FORM.RUNMODAL(FORM::MyForm, MyRecord);

or

MyRecord.SETCURRENTKEY(…);
MyRecord.SETRANGE(Field01, …);
MyRecord.SETFILTER(Field01, …);
MyForm.SETTABLEVIEW(MyRecord);
MyForm.RUNMODAL;

This problem is solved in this thread.

You can use FILTERGROUP 2 for this.

http://www.mibuso.com/forum/viewtopic.php?t=14712&highlight=

Correct.

Oddly it looks like three people (Alain, Claus and I) all read this as a request to change SourceTable. What’s the odds that three people miss read the same post.

Yes, a bit odd. I guess I started it.[:(]

Correct. To many ways to give you examples on what they are requesting.

Remember your suggestion may be different then what the client really wants.

  1. Do they want to filter on specific things?

  2. Show different information.

  3. Bring up different forms depending on whom (UserId) they are?

  4. Prevent them from looking up other forms.

The list will go on and on. So, come back and give us as much information as possible.