Record is not getting saved while using Calculation

Forum to discuss the Web client version of Servoy.

Record is not getting saved while using Calculation

Postby ayadav1 » Thu Jan 19, 2017 4:29 pm

Hi,

I am displaying the set of records with one Calculation column. In calculation column I am displaying the Unit Price after after applying some formula.

I f I am adding new records under child table of selected parent records then I am getting error of infinite loop. And one thing also I am doing that I am grouping a column with calculation column to display the records of row.

When I am not including the calculation column in group then I am not getting any issue the application is working fine.

Issue is coming when I am adding calculation column in grouping of column.

And to calculate the value for calculation column I am using some relation to get dynamic real time data.

If anyone wants to seen the code snippet then I can share the code snippet.

Thanks,
Abhishek
ayadav1
 
Posts: 21
Joined: Thu Oct 20, 2016 2:40 pm

Re: Record is not getting saved while using Calculation

Postby Bernd.N » Fri Jan 20, 2017 1:15 am

Best thing you could do at the moment is to not using a calculation for this field, as it seems to have a quite complex calculation function.
Better fire that function explicitly towards a stored field when you know it is appropriate, to have more control of its calling.
That moment would be when the user hits the save button after adding or editing a child record (so you need an edit-save-concept for this).
You could also call the function in all onDataChange-events of the affected fields.

However the infinite loop could not be related to the fact that you use a calculated field. It could well be inside the function itself.

Make sure your code is totally clean and as simple as possible (no complex spaghetti code :) ), that's the best measure against bugs.

When I understand you right, the calculation is summing up some children, and I guess there are also several fields inside the children, like price and quantity for example.
So you first need to make sure that the children's total is always perfect, and only then you can total all children.
Bernd Korthaus
LinkedIn
Servoy 7.4.9 SC postgreSQL 9.4.11 Windows 10 Pro
User avatar
Bernd.N
 
Posts: 544
Joined: Mon Oct 21, 2013 5:57 pm
Location: Langenhorn, North Friesland, Germany

Re: Record is not getting saved while using Calculation

Postby patrick » Fri Jan 20, 2017 12:45 pm

Could you show us the calculation? A loop sounds like something is wrong in your code.
Patrick Ruhsert
Servoy DACH
patrick
 
Posts: 3703
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany


Return to Servoy Web Client

Who is online

Users browsing this forum: No registered users and 5 guests