Hi,
I posted recently about trying to sort columns based on a calculation. I have since added a column to the table to store the calculation. Here is the code that I am using to sort the column:
// Sort ascending to descending
var test = application.getMethodTriggerElementName(); // create variable to test against using ==
if (test == “level_1”){
if (globals.gSort)
{
controller.sort(‘core_hierarchy_level_to_core_hierarchy_emp_cost.cName1 asc’);
globals.gSort = null
}
else
{
controller.sort(‘core_hierarchy_level_to_core_hierarchy_emp_cost.cName1 desc’);
globals.gSort = 1
}
}
When I click on “level_1” which is the column heading to sort based on the data in level 1 the entire table disappears. I have to then click Show All to refresh the table.
Here also is the stored calculation for cName1:
var emp1 = emp_cost_to_emp.first_name + " " + emp_cost_to_emp.last_name;
return emp1;
It is not possible to display the column storing the calc on the form. The only option I have is to display the calc itself.
I have colleagues who are experiencing the same problem I am.
Is this a bug?
I will attach examples. I believe you have to be logged in to view them.
Thank you again for all your help.
Matt
I am running Windows XP. Servoy version 3.5.5. Java version 5 Update 11.
What might be a problem is your dataprovider
core_hierarchy_level_to_core_hierarchy_emp_cost.cName1
As far as I know, Servoy handles all dataprovider names in lower case. So what happens if you do
core_hierarchy_level_to_core_hierarchy_emp_cost.cname1
instead?
I tried that same results.
It does not matter, but why is that?
It is not possible to display the column storing the calc on the form. The only option I have is to display the calc itself.
And: is that relation an inner or left outer join? Try left outer join. With an inner join, all rows that do not have a related record at all, will disappear.
I tried both inner and outer join in the relation with the same results.
What I mean is that when I go into design mode. I click the button place field. The “Specify field(s)” dialog box pops up. I select the appropriate relation. Under columns the columns which store the calcs are not appearing. Of course under calculations all the calcs appear. I’ll attach a screenshot for clarification.
Hi, are you sure your calculation has actually been updated and stored?
Sometimes you need to recalculate the records after creating or changing calculations. I think there is a function which will do this, in the databaseManager I think.
I have used Enterprise Manager to verify the contents of the columns. They indeed are storing the correct information.
that specify fields dialog is correct, we dont show a column twice because it will aways be a calculation not just a column.
If we also would display it under columns what would you expect different behavior? Because that is then exactly the reason why it isnt specified there.
i think it is a relation problem (no results found for the relation so the row will disappear)
Can you check what query is generated and for example use that in your enterprise manager?
The query can be get for example in the admin pages (performance data)
I agree it is definitely a relation issue. I created a new form with only the specific column I am trying to sort and placed it in table view. It disappears when I try to sort.
I am not sure exactly how to extract the query that is generated. Is that done from Servoy or Enterprise Manager?
Look for example at the performance tab in the servoy admin pages. There you will see all the queries that are generated and fired to the database.