Can't edit existing calculation
Hey guys,
I'm not really sure why, but the calculation field that's been working fine for some weeks now can't be edited anymore. Even if I don't change anything, when I try to save the app again it says: The script returned an undefined result. And I have no clue whatsoever why. This is the calculation:
if(@Terms == "€120 / year"){120}
else if(@Terms == "€120 billed each year"){120}
...
@Terms is a text field. Hence all I want is to translate the text input into the actual amount in €. As I said, this has been working perfectly so far and continues to do, though I can't make any changes to the app anymore?
I've cloned the app, thrown out all other calculation fields and only went with one if statement. Still doesn't work, so I guess the issue is with something in the calculation which worked before, but now for some reason doesn't anymore?!
Also, I tried both with defining the calculation field as both either text or number field, but neither version works.
Any ideas?
Thanks in advance!
Kind regards,
Philip
-
Dear Andreas,
as stated above, the condition is met! So this can't be the cause of the problem, unless I'm totally mistaken. I'm quite new to this, so I might very well be. As outlined, the error message even states the right output (120) but complains that it is not a valid value - which is what I don't understand?
Thanks so much!
Kind regards,
Philip -
Check the field type (a calc field can be either string, number or date, this is set when you initially save the field, and you can't change it afterwards); click the field settings wrench, if you see a rounding option, it's number, date options, it's date, and no specific option means it's string.
What you're saying above seems to say that your field type is string, not number.
I would either rebuild the field from scratch and be sure to save as number (just output a number as you initially save, then edit again with your script), or add
.toString()
after 120 in your script, AND add a final else whatsoever. HTH. -
I did exactly as you said, defined the field as a numbers field. Now, even if I make it as simply as: if(@Terms == "€120 / year"){120} it says the result is not defined. Even though the condition should be met.
For test purposes, I defined @terms as test and tried to go simply with text output. Even if I define the calculation field as a text field, it doesn't work :(
Kind regards,
Philip -
Dear all,
Thank you so much for all your support. Now, I just ran a test and it appears that the issue is NOT with the calculation, but with the way Podio reads fields. I just created a test app to see, whether something was wrong with my initial app for some reason and tried two different scenarios: One with a referenced text field, one with a referenced category field. Turns out, the category field works perfectly fine with the calculation, but the simple text field is throwing the same error I've been having issue with. So I guess Podio actually changed something in the backend, because it actually DID work when I created my app a few weeks ago. I'll reach out to them and let you know more, once I've heard back from them.
Thanks again for all your efforts!
Kind regards,
Philip
Please sign in to leave a comment.
Comments
12 comments