I have a form with a tabpanel which contains a form (list view) showing the child records of the record shown in the main form. The child form obviously has a separate foundset. All worked fine in a prototype, eg in a form to test the functionality of a dynamic tree representation of an organization structure.
When I moved the prototype tab panel inside another form already having a tabpanel the child form stopped loading the records and clicking on the nodes to expand the tree view also did not work anymore. After many frustrating hours I discovered that inserting in the methods a databasemanager.saveData before controller.loadRecords() resolved the issues.
The real strage thing is that i did not edit any record and the records used were exactly the same used for the prototyping phase.
We don’t know the methods you use, when you use them, what Servoy you use, what platform you are on, what Java version you work with, if it occurs in Developer or in Client etc.
When I moved the prototype tab panel inside another form already having a tabpanel the child form stopped loading the records and clicking on the nodes to expand the tree view also did not work anymore.
is this another tab inside the existing tabpanel or anohter tabpanel?
You are perfectly right. My fault. I understand this issue seems complex and I just wanted first to know if this behavior was known or not.
Let’s start with the easy things: the problem occurs in developer (I have not yet tried the client), Servoy is 3.5.3 and platform is Mac OS X 10.5.1, Java is the default for the Mac (1.5 I suppose).
Tabpanels, this is a good question. I also suspected the issue had something to do with the way I used tabpanels in the form, but it seems that this is not the culprit. First I put the child listview form in a tabpanel inside another tabpanel. When I discovered the problem I created a new separate tabpanel on the main form, but the problem persisted.
Please note that when I worked on the prototype, I used a very basic form with just a field for the main form and the same child form I then moved to the “production” form (I say production because I am just “playing” and not really working on anything real), everything worked. So it is the same schema in both situations.
The main form now is made of: one tabpanel used for navigation (with a listview of the records in the foundset), two tabpanels used to simulate “pages” of the form containing the detail data (record view of the selected record) and the tabpanel (now inside the tabpanel for “page” 1) with the child form showing the child records for the selected record. This child form obviously uses a separate foundset, while the others share the same foundset.
What I am trying to do: to represent a hierarchical organization (such as the various departments, branches and offices of a corporation, but it could be used for anything that can be shown as a tree).
The methods: they are simple from a logical point of view but the implementation has been quite complex. They are just three:
a) the first one sets a symbol (a gif image inside an html area) for each record showing if there are dependencies to show. It is fired first when the main (parent) record is selected;
b) then a method that creates as many associative arrays as are the “branches” of the organization tree that should be represented. These associative arrays contain both the pks of the records (to use in controller.loadRecords) and the record codes used to establish a relation between two or more “branches” (eg the main one and the dependent ones). This method is fired after the first one when the parent record is selected. All queries are written in SQL, so there is no manipulation of records inside foundsets;
c) the third method is fired when the user wants to close or open a “branch” to show or hide dependent “branches”. It chooses which pks to load from the appropriate associative arrays. The queries are all written in SQL.
If anyone is interested I could post a sample solution. I was in fact thinking of publishing it in case anybody needed to use a “tree” model in her/his solution. But I am not so sure my coding abilities are good enough to publish anything not laughable.
Well, the laughable stage is where we all have to go through
Thanks for the clarification.
If I were you I would post a sample solution to see what is going on.
BTW maybe you should take a look at our TreeView Bean which is built to do what you want including drag and drop etc.
You can find more information here: http://www.it2be.com/beans.htm#treeview
Hi rioba,
I have also had a similar problem.
But not using the treeview bean . Rather I would be very interested to use your attempt in my next solution. Could you also send your example to me?
Well, has happened to me that in my solution, that up to when I have not confirmed all the changes to the data, the system Servoy(without to tell) it was refused of to effect any other operation. But I had not edited anything. Then I have realized that I could resolve the problem with a function saveData (). Did it go to effect the rescue of data (not modified!!?) in my calculations.
Also uses of the calculations?
Because I have noticed that Servoy, every time that I open my solution, it restarts to save the data of my calculations, also without having made some change. I use the automatism of the Table Events.
Perhaps also to you the same thing happens. Then, the use of the representation to tree seems that this is not the culprit.
Servoy 353
Anywhere 9.02
Windows
I also use stored calculations to format the fields (HTML AREAS) according to their respective position in the hierarchy. In fact I tried to remove them to see if the problem could be there, but the behavior did not change. However now, after inserting a few databasemanager.saveData() in the code, everything is working almost as expected. But only until I add a new record to the database.
After creating a new record the form (listview) inside the tabpanel freezes and clicking on buttons or fields associated with an onAction method doesn’t fire the method anymore. I use a button for each record to open or close the node to show/hide the tree. After adding a record to the database this functionality is lost. Quite irritating.
UPDATE - ISSUE SOLVED: This last issue has been solved. The problem occurs with the child (listview) form in a tabpanel inside another tabpanel. Moving the tabpanel to the main form makes the listview form behave correctly also after adding records to the database.
P.S. I am preparing a sample solution. As soon as it is finished I will certainly share it.
Thanks Rioba, I am happy that you have resolved that problem.
But remains the first issue that when I open my solution, the system Servoy fire the method link of the Tables Events.
Seems it re-performs some calculations of the loaded form.
Hi Marcel,
I have found the cause but not understand how to resolve it.
Now, at solution opening , but also when I don’t perform any change, every time I go on form, Table Events fire data validation check method.
I don’ t understand if re performs the calculations system or simple listen what are different values on the same field form or db.
Some errors have been corrected inserting in the calculations the rounding with : Math.round(10,455*100)/100 or return parseFloat ( (num1 / num2).toFixed(2) )
While others errors have been remaining. In this part of the solution I use Autosave(true) and application.output(field) to check execution.
Origin field 31,36 (right) and aggregation 31,35 (wrong)
Calculation that uses a multiplication percentage: 31,35 sub (31.35 mult 1) /100= 31.04 (right, 31.35 sub 0.31) and not 31.03(wrong, 31.35 sub 0.3135)
Finally,On Db:
Origin field= 31,35 (wrong)
Aggregation field 31,35 and calculation field=31,03(wrong)
Are already happened to me on fields Numbers with two digit: input=3,20 and Db/Form=3,19.
I had issue resolved inserting a new field Double instead Number.