Page 1 of 1

servoy 4 calculation using value from database

PostPosted: Fri Jun 20, 2008 9:14 pm
by darthtall
var test_email = login + "@mydomain.com";
return test_email;

this code does not work????????????

login is a field in the table and has a value of fred.
the calculation above returns nothing

When I do this!

var test_email = utils.srtingtrim(login) + "@mydomain.com";
return test_email;
this calculation returns fred@mydomain.com;

is there a way to run the calculation without the trim?

PostPosted: Fri Jun 20, 2008 9:48 pm
by IT2Be
So, to completely understand.
Make sure that we help you with what really seems to be your problem...

You are trying to make a calculation work?
login is a column in your table?
login really exists and has a value?

Please, please be more specific!!!!
Many on the forum, if not all, try to help you voluntarily.
So help us to help you by asking a question instead of making a puzzle...

-- original post was edited by poster --

PostPosted: Fri Jun 20, 2008 10:27 pm
by IT2Be
what datatype is the calculation set to?
and what datatype has the column login?

btw I would always check that login is not null!

answer

PostPosted: Fri Jun 20, 2008 10:30 pm
by darthtall
the calculation is set to datatype text
the login column is text

how do you check for null before calculating?

thank you for you help

PostPosted: Fri Jun 20, 2008 10:43 pm
by IT2Be
Code: Select all
if (login == null) {

}
is ok or
Code: Select all
if (!login) {

}
will check that login is not null and not "" (or 0 if int/number)

Have you tested with only one record or more?

This really should work.

What when you re-enter 'fred'