Hello,
I have just come across something that I find very strange and don’t see what I am doing wrong. Here is the setup:
- Two tables “Main” and “Related”, where Related holds related data to main
- One form based on Main (“Form M”)
- One record view form based on Related (“Form R1”)
- One table view form based on Related (“Form R2”)
- One form based on Related (“Form R”) that has two tab panels: one shows R1, the other shows R2, both tabs as unrelated (all three R-forms are based on the same table).
If I may a try to “graph” this:
Form M → tab panel → relation to R → R → tab panel → unrelated R1, R2
Now I show Form R through a relation in a tab panel on Form M. I expect Form R to get the related foundset and to share that with R1 and R2. Thus, when I browse through M, I always get to see the related records in whatever R-form.
But this is not what happens. All records of the R-forms are shown all the time, whatever record on M I sit on.
I have a demo solution that shows this behaviour. But maybe I do something wrong?
Thanks Patrick
Are you wanting to show data several relations deep?
Example:
Customer has some invoices with some line items which are linked to inventory.
Customer → invoice → line_item → inventory
A user may want to see all the items the customer has ever bought, within our inventory.
So you want to place a field or tab panel that shows just those records, based on the link relation, from the inventory table. Is this what you are talking about?
No, it is just one relation (form M → R). The problem is, that the foundset of the forms of the related Table shows all records instead of only related records. This obviously happens in this setup…
With what version of Servoy is this ?
Also what does the relation look like ?
I work with build 320 and the relation is main.main_id to related.main_id, so pretty straight forward
. The problem lies in the setup of that form R, that shows a tab panel with the single record view and the table view in another tab panel. This is, where foundsets get ouf of synch somehow.
Can you send me your demo solution (with sample data)?
My email is available under this post.
When I moved some solutions of mine to 2.2rc1 (and rc2-320) I found this behavior too. Even when I created a brand new record it immediately showed related records (relating to a null value?!).
But I have a hard time reproducing this in a new solution.
See thread: http://forum.servoy.com/viewtopic.php?t=3832
Maybe your issue is related, if so your example might shed some light on what makes this issue occur.
Patrick,
Thanks for the demo solution.
It looks like this is exactly what happens with my solutions.
It seems any relation deeper then 1 isn’t updated/triggered and shows the last found set for that form.
I will do some more tests but this definitely is getting us somewhere in determining where the problem lies.
I did some testing and came up with the following.
To make the situation even more clear this is the datamodel
+---------+ +---------+
| table 1 |--<| table 2 |
+---------+ +---------+
We have a main form (using table 1) with 1 tabpanel with 3 tabs:
tab 1: showing a related form (using table 2)
tab 2: not important in this explanation
tab 3: show a related form in table view (using table 2)
The form in tab1 has 2 different tabpanels each having a relation-less view on 2 different forms.
form 1 is a record or listview (using table 2) (both views give the same result in this test)
form 2 is a table view (using table 2)
All forms have UseSeperateFoundSet disabled.
In the main form clicking on tab3 forces the correct found set for this relation (only with Table View this happens).
Now moving back to tab 1 with it’s multi view only the deeper table with table view shows the correct found set.
Using any other view (list/record) shows unrelated records.
Since we used relationless tabs in the first form I created a another table related to table 2.
Thus like this:
+---------+ +---------+ +---------+
| table 1 |--<| table 2 |--<| table 3 |
+---------+ +---------+ +---------+
I added a 3rd tabpanel to the first form and related it to a form in list or record view (using table 3).
Now viewing tab 1 on the main form it shows the related table 3 data correctly.
But the table 2 data is still not correct.
So it seems the problem lies with the unrelated tabs and also with the list/record view.
Like stated in my previous posts on this matter: this is truly a showstopper.
I hope the dev team can use this extra info to get this bug nailed.
it is pretty logical what happens (at least in the sample you send me)
You are not setting the data youreself at someplace in youre unrelated tabs
You MUST do that. Servoy will nog do anything with unrelated tabs. We will not set any data in it. That is the developers job (in a main forms on record selection or any other method)
Johan,
The mainform relates to the forms (table2) in the tabpanel (so 1 deep).
The other tabpanels on those forms show to other forms that display the same data (table2). Thus showing the same foundset.
At least it should show the same foundset. That’s what this issue is about.
Okay I did some more testing. In fact I made the same demo solution in 2.1.2.
And indeed the foundset of relationless tabs are not updated. So I made a wrong conclusion here. ![Embarassed :oops:]()
But I did find that 2.1.2 does change the foundset in those relationless tabs when you select a related tab to the same form in list-, record- or table view.
The test solution in 2.2 only did that when you used a table view.
So there are differences in behavior here.
In a sense it’s a bit odd that you have 2 forms that have the same base table (table2) and therefore have the same foundset (right?) still show different found sets when you use them in a related tab and from that related form (table2) a unrelated tab to another form (table2).
You would think the first (related) form would change the foundset as well for the unrelated form like it does when you switch back and forth from another tab that relates to the previous unrelated form. (do I make any sense here?)
In my solution that broke after converting to 2.2 I do use some unrelated tabs, again all using the same base table.
I wonder if this difference in behavior from 2.1.2 is the culprit.
I will do some more testing to see if I can pin it down some more.
a related form will NEVER be the shared foundset.
There is only on shared table foundset. That is the default foundset of a form (or when you do loadAllRecords() if you dont have a useSepareteFoundset)
Related foundset are all over the place so if you have 2 forms A and B. both are showing the shared foundset.
If you then set then a related foundset in A then B will still ahve that global shared foundset.
Because if we have 3 forms A,B and C.
Now we are setting a related foundset in A and in B (both different)
Then what should C show??? the related foundset of A or of B???
summarize: there is a global shared foundset. that is the default when using loadAllRecords(). Never will a related foundset be a shared one.
Then what should C show??? the related foundset of A or of B???
Maybe (A+B) / 2 ![Laughing :lol:]()
I understand the point. The reason why we all stumble here, I think, is this: Servoy takes care of the foundset in a form that is shown via a tab panel. In between is a relation. This is how we (hopefully always) can be sure what we get to see.
Since the forms “in question” are placed on a tab panel themselves all of us expected them to also be related (better than: share a foundset), just because we looked through our panels and saw the wrong records. ![Embarassed :oops:]()
On the other side is it difficult to replace the setup with something else that is not complicated. If this behaves as it does, you will need more relations, globals and/or methods that load records.
The discussion of “foundset management” (one of my personal favourites) leads me more and more to manage foundsets myself. I pass and load foundsets as the user walks along. I find that far more understandable, logical and stable than expecting Servoy to show the records I want. I wonder if this is somehow heavy operation… Unfortunately in this scenario it is a little difficult to find an elegant way of passing foundsets if the users browses through records in the main table.
Patrick
Okay I get the concept of shared foundsets.
What can you tell about the difference in behavior I talked about between 2.1.2 and 2.2?
The discussion of “foundset management” (one of my personal favourites) leads me more and more to manage foundsets myself. I pass and load foundsets as the user walks along
that is exactly how a developer should do it!
Portals or tabs build on a relation is ofcourse different. That is handled by servoy. But main forms or relationalless tabs is the developer responsibility.
What can you tell about the difference in behavior I talked about between 2.1.2 and 2.2?
then i must see it. But a tab without a relation should be touched anyhow by servoy. Except if you are showing there the shared foundset (loadAllRecords) and searching in that one. Then it will change.