Calculations do not work
Hello!
Can anyone tell me why I get errors in my calculations?
please look http://screencast.com/t/MEUSeApLYJL
or: ((@Maat boor === "16 mm") && (@Aantal verdiepingen === "1 verdieping")) {
15;
} else {
"";
}
and this one
-
Hi Stijn,
I think in the first calculation there's missing an if:
if(@Maat boor == "16 mm" && @Aantal verdiepingen == "1 verdieping") {
15;
} else {
"";
}You can write it also this way:
@Maat boor == "16 mm" && @Aantal verdiepingen == "1 verdieping" ? 15 : ""
I assume, the second code you need to avoid that there "null" is shown if a field is empty.The code looks correct - do you get an error notification for it too?
I would do it in shorter way:
(@Voornaam + ' ' + @Tussenvoegsels + ' ' + @Achternaam).replace(/(null )|(null)/g,"")
One tip: If you have to use the same variable token mulitple times a code you should declare it as var in the beginning, so you have to select the token only once from the popup list (this makes the code more readable and you can cope parts of it):
var vn = @Voornaam;
var tv = @Tussenvoegsels;
var an = @Achternaam;
if(vn && tn && @an) {
vn + ' ' + tn + ' ' + an;
...
and so onHere you find some rules and tips for using variables.
Rainer
-
Well, doesn't the first one miss "if" from the beginning?
Also, remember that calculation field's type is set by its first return. If it returns a number first, it wants to return a number. If it returns text, it wants to return text. To reset this the calculation field needs to be deleted and recreated.
Please sign in to leave a comment.
Comments
5 comments