AOT node save problem using treenode class

Hello,

I am using TreeNode class for saving AOT query node range. But if multiple client use same functionality at a same time then it will return unable to save error message. Is there any solution or ulternative way for saving AOT node.

Thanks.

What exactly is the problem? They’re trying to save the same tree node? You can try to refresh the node just before updating it, but users can still try to update it in the same time. You would have to implement a kind of locking, i.e. only one session at time would be allowed to run the update.

Nevertheless my recommendation is not doing it all. You can get into many troubles (conflicting changes, caching and so on). Why don’t you simply save the modified query to database?

Exactly problem will rise when they will try to save same tree node. can you tell me please how can i save modified query to database.??

Or is there any specific solution to apply AOT query node range dynamically??

This will hopefully give you some idea about what’s possible:

// Create query objects from an AOT query
Query query = new Query(queryStr(Cust));
// Find the data source defined in AOT
QueryBuildDataSource ds = query.dataSourceTable(tableNum(CustTable));
container packedQuery;

// Add range    
ds.addRange(fieldNum(CustTable, Blocked)).value(queryValue(NoYes::No));
// Pack the query to container (you can save containers to database)
packedQuery = new QueryRun(query).pack();

It will not affect view data. actually my task is create a query with datasource which has variable range and i am passing this query to view. So range will affect view data and i want to use this afeected data.

I think it’s a bad idea. In addition to other issues, you would have to even synchronize your business database at runtime.

Simply use the view in a query and apply ranges to the query as usual.

Ya finally i realize it was bad idea.