DBTreeView bean smart client issue.

Hi All,

I have used DBTreeView bean in my servoy application. DBTreeView bean is heart of my application. DBTreeView bean working well when application is accessed by single smart client. It creates problem when two or more client accessing the same.

I have main form which contains DBTreeView bean. Which displays the nodes according to which user loged-in in the application. Let there is two user A and B. A and B have different node view permission. When user loged-in first and he’ll see all his related nodes. while user A is in application user B has loged-in. When user B loged-in the application, all the related node will display for B but the All the nodes for user A will deleted from the tree. Servoy gives the information that other user changed the data.

I think it should not happens in DBTreeView case. Is it expected behavior?
If this is expected behavior. How can i handle this problem?

Thanks
Prem

Hi Prem,

pcm:
I have main form which contains DBTreeView bean. Which displays the nodes according to which user loged-in in the application.

How are you filtering the nodes per user ? I think your issue has something to do with the way you accomplish this.

Hi Robert,

Thanks for reply… i got your point :D .

ROCLASI:
How are you filtering the nodes per user ?

I didn’t think about it.

Thanks
Prem

Hi Robert,

I am facing another problem. Problem is, let user A loged-in first he is viewing his tree. After that user B loged in, when user B is navigate to his tree. Where root node of user A is appearning is user B’s tree.

What i guess when i am passing self relationship. it always show patient record. How can fix this one.?

Thanks
Prem

Hi Prem,

Can you explain exactly what you are doing, including the code that sets up the DBTreeView?

Hi Robert,

I have main form in my application. This main form contains DBTreeView bean and other forms, which navigate according to selection of tree node.

When ever user loged-in i am verifying the user permission on tree node, according to node permissions tree is populating.

here is sample code.

var nRootNodeId = globals.NodeId++;

//Create Root Node
forms.NavFrm_TreeCtrl.controller.newRecord(true);

forms.TreeCtrl.user_idx = globals.user_idx; //Giving user idx who is loged-in.
forms.TreeCtrl.node_id = nRootNodeId;
forms.TreeCtrl.font_type = ‘Tahoma,0,10’;
forms.TreeCtrl.image_data = plugins.images.getImage(forms.dev_Node_Image.root_ok);
forms.TreeCtrl.level_type = 0;
forms.TreeCtrl.node_no = nRootIdx;
forms.TreeCtrl.node_text = sNodeText;
forms.TreeCtrl.node_type = 1;
forms.TreeCtrl.parent_id = 0;
forms.TreeCtrl.record_no = nRootIdx;

//Creating child node
forms.NavFrm_TreeCtrl.controller.newRecord(true);

forms.TreeCtrl.user_idx = globals.user_idx;//Giving user idx who is loged-in.
forms.TreeCtrl.node_id = globals.NodeId++;
forms.TreeCtrl.font_type = ‘Tahoma,0,10’;
forms.TreeCtrl.image_data = plugins.images.getImage(forms.dev_Node_Image.root_ok);
forms.TreeCtrl.level_type = 0;
forms.TreeCtrl.node_no = nRootIdx;
forms.TreeCtrl.node_text = sNodeText;
forms.TreeCtrl.node_type = 1;
forms.TreeCtrl.parent_id = nRootNodeId;
forms.TreeCtrl.record_no = nRootIdx;

//Creating child node
forms.NavFrm_TreeCtrl.controller.newRecord(true);

forms.TreeCtrl.user_idx = globals.user_idx;//Giving user idx who is loged-in.
forms.TreeCtrl.node_id = globals.NodeId++;
forms.TreeCtrl.font_type = ‘Tahoma,0,10’;
forms.TreeCtrl.image_data = plugins.images.getImage(forms.dev_Node_Image.root_ok);
forms.TreeCtrl.level_type = 0;
forms.TreeCtrl.node_no = nRootIdx;
forms.TreeCtrl.node_text = sNodeText;
forms.TreeCtrl.node_type = 1;
forms.TreeCtrl.parent_id = nRootNodeId;
forms.TreeCtrl.record_no = nRootIdx;

Here is self relationship.

Relation name : node_to_node
Relation Keys :node_id = parent_id
globals.user_idx = user_idx

Example of Problem .
User A Login first : his tree structure will be

ARootNode1
—AChild1
—AChild2
—A…
—An

After that User B loged-in : his tree structure is

ARootNode1 //This Node is a problem. It should not appear over here.
BRootNode2
—BChild
—BChild
—B…
—Bn

The problem is when two or more users are in there session. Root node of first user appearing in second user’s tree or vise versa. As number of user increasing the Root node of different tree’s show in different user’s tree.

Thanks
Prem

Hi Prem,

The DBTreeView beans takes a foundset as rootnodes. Do you do a search on the foundset before you add it to the bean ?
Something like this:

if ( controller.find() ) {
	controller.user_idx = globals.user_idx;
	controller.search();
} else {
	// couldn't get into find mode because of unsaved records
}
elements.yourTreeBean.addRoots(foundset);

Only the childnodes will filter over the relationships.

Hope this helps.

Hi Robert,

ROCLASI:
Do you do a search on the foundset before you add it to the bean ?

You r gr8 :D .

I missed that one :shock:. Now it is working well.

Thanks robert for being with me…

Thanks
Prem