calculation fields

Questions, tips and tricks and techniques for scripting in Servoy

calculation fields

Postby Ron » Sat Jun 07, 2003 8:58 am

I want to make a calculation-field.
So I created two colums: INPUT and CALC
Now I want to make a simple calculation like: CALC=INP*2
I want the result to be showed in the CALC field and to be stored in de DB.
What is syntax?
:x
Ron
 
Posts: 315
Joined: Fri May 23, 2003 12:30 am
Location: Netherlands

Postby maarten » Sat Jun 07, 2003 10:43 am

Stored calc:
1) create column "calc" in your table
2)create calculation with same name "calc"
(Servoy matches the two, and stores calc result in database

Unstored calc:
1) only create calculation


notes:
-you can turn an unstored calc into a stored one by creating a column with same name.
-unstored and stored calcs always get refreshed when needed in GUI.
Maarten Berkenbosch
User avatar
maarten
 
Posts: 797
Joined: Wed Apr 23, 2003 10:52 pm
Location: Amersfoort, Netherlands

Postby Ron » Sat Jun 07, 2003 1:08 pm

Sorry Maarten, it still does'nt work.
This seems more complicated than in filemaker, but I don't give up (yet).
Now what I did step by step.

1. Created column INP (value: number)
2. Created column CALC (value: number)
3. Created calculation CALC (value: number)
Indeed type STORED.
Now putting the calculation itself: line1: Return 1; (default)
line2: INP+2;


Testing: entering "5" in INP field: nothing happens in CALC field, it stays empty.
What went wrong?
Ron
 
Posts: 315
Joined: Fri May 23, 2003 12:30 am
Location: Netherlands

Postby Ron » Sat Jun 07, 2003 2:27 pm

PROBLEM SOLVED! :D

What went wrong?

Code was not correct.
shoud have been: line1: Return inp+2
But also I did'nt notice there were no recs in my database!
Also I had a look first in the CRM, for the code.
Ron
 
Posts: 315
Joined: Fri May 23, 2003 12:30 am
Location: Netherlands


Return to Methods

Who is online

Users browsing this forum: No registered users and 6 guests