Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Calc Object in Browse Form

Questions related to using nuBuilder Forte.
Post Reply
Mopatops
Posts: 3
Joined: Tue Oct 20, 2020 7:51 pm

Calc Object in Browse Form

Unread post by Mopatops »

Hi All

First off, sorry if the answer to this is already in the forum, but I have had a good look and couldn't find my answer.
I've recently started to learn nuBuilder, and am slowly getting my head around it. It's a great program, and I'm surprised how quickly you can have a working database.

My problem. When I create a Fast Form, and add a CALC object to it, it gives the tick option to be on the browse form. It does it's calculation OK on the EDIT form, but the browse form just stays at zero. It also creates a field in the database, which was unexpected. Because it's calculated live, I thought it wouldn't have a field in the database?
This seems to be the value that it reads in the browse form (it changes if I manually edit the database), and doesn't preform the calculation like the EDIT form does.

I may be reading the CALC object totally wrong, and having a calculation on the browse form may be bad programming, but it is leaving me a bit confused.

Thanks for any help.

Steve
Mopatops
Posts: 3
Joined: Tue Oct 20, 2020 7:51 pm

Re: Calc Object in Browse Form

Unread post by Mopatops »

I've just been playing around a little more and noticed the live calculation does populate the CALC database field when saved from the edit form, so I'm now guessing the calculation is preformed on the edit form only, and stored in the database for use on the browse form?
I had been adjusting the values away from the edit form (it's actually on a subform), and nothing was changing on the browse form, but if I enter the edit form and press save, the value then appears in the browse form. This means the browse form does no calculation of it's own?

If this is correct, I assume I should only let the values be changed in the form that does the calculation, and knowhere else?

Steve
Janusz
nuBuilder Team
Posts: 506
Joined: Fri Dec 28, 2018 1:41 pm
Location: Krakow, Poland
Has thanked: 8 times
Been thanked: 18 times

Re: Calc Object in Browse Form

Unread post by Janusz »

Hi,
I think the calc object is not good to be used in browse form and me I newer tried to use it. If you need any calculation to be performed in the browse you can use any sql statement in the Form/Browse/Display field for example:

Code: Select all

REPLACE(REPLACE(rej_month_closed,1,'✔'),0,'')
or 
DATE_FORMAT(rej_activity_month,'%Y-%m')
or
...
I would use it only on edit form - but even there I prefer display object to use if I need some calculated data - but of course it depend on the DB specificity.
If you like nuBuilder, please leave a review on SourceForge
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Calc Object in Browse Form

Unread post by admin »

Mopatops,

You are correct, any calculations are done on the Edit Form.

So unless your table has been updated from somewhere other than the Edit Form, you should be OK using a Calc Object in a Browse Form.


Steven
Mopatops
Posts: 3
Joined: Tue Oct 20, 2020 7:51 pm

Re: Calc Object in Browse Form

Unread post by Mopatops »

Thanks for the replies. A slight modification to my database so values cannot be adjusted away from the edit screen, and it's now working perfectly.

Thank you

Steve
treed
Posts: 205
Joined: Mon May 18, 2020 12:02 am
Been thanked: 2 times
Contact:

Re: Calc Object in Browse Form

Unread post by treed »

For others that are looking for info on this, I just figured out not to put the calc in the browse SQL. Put the SQL code for the calculation in the display section and it works great. However ;-), being able to make a new calculated column in the SQL and referring to that column in the display section, I believe, makes the code more maintainable because it can be pasted into the database SQL screen and tested/viewed. Just a thought.
Post Reply