by Bernd.N » Wed Aug 17, 2016 10:03 am
Please try first my example that I provided, because only then you have a general answer to the question "Do calculations work at all or not in my Servoy ?"
I would not recommend to use utils.hasRecords() inside a calculation, because - at least to my knowledge - utils.hasRecords() will issue a single SQL count.
You can mimic that by just adding and maintainig a counter to the basic record, so that it knows itself if it has children/linked records or not, without the use of utils.hasRecords().
Then you can use that counter in the calculation.
So try to take out the hasRecords() first and to replace it by an inner counter, it should work then.
Additionally, you could use a var sColor that you set inside the if-else, and then you make only one return after the if-else where you add the rest of your needed html code.
Makes the code more clean and lean.
Ah, and there is a final else branch with "return null" - it could also be that your function runs into that.
Replace it with a return "FINALE ELSE" temporarily to see if you are running into that else-branch.
Bernd Korthaus
LinkedInServoy 7.4.9 SC postgreSQL 9.4.11 Windows 10 Pro