Can't edit existing calculation

Comments

12 comments

  • Andreas Garnæs

    Hi Philip,

    When neither condition is fulfilled, the script returns an undefined result. Please try adding a final else clause.

    Best,
    Andreas

    0
    Comment actions Permalink
  • Rainer Grabowski

    Hi Philip,

    I've heard, that another Podio user has a similar problem. Submit a support ticket to Podio and tell them the item id and app id

    0
    Comment actions Permalink
  • Philip

    Dear Andreas, the condition is met! That's why it's working on the actual app?!

    Kind regards,
    Philip

    0
    Comment actions Permalink
  • Adrien BLAISE

    I'd try adding a final else { 9999 } just for troubleshooting purposes (to be sure you're not getting 9999...).

    Is the text field required? If not I'd add an initial:

    var text;
    @Text !== undefined ? text = @Text : text = ""
    

    FWIW.

    0
    Comment actions Permalink
  • Philip

    Well, if I add your suggestion, Adrien and I guess you referred to @terms instead of @text, it gives me "invalid value, 120 (number): must be a string"

    Also, if I'm not mistaken, if no condition were met, the field should simply not display anything?!

    Any idea?

    0
    Comment actions Permalink
  • Andreas Garnæs

    If the condition is not met, the script returns Undefined which is the issue. You should add an else-clause that returns a numeric value.

    0
    Comment actions Permalink
  • 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

    0
    Comment actions Permalink
  • Adrien BLAISE

    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.

    0
    Comment actions Permalink
  • Philip

    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

    0
    Comment actions Permalink
  • Adrien BLAISE

    Add a final else { null } and it will work.

    0
    Comment actions Permalink
  • Adrien BLAISE

    IOW:

    if(@Terms == "€120 / year"){
    120
    }
    else if(@Terms == "€120 billed each year"){
    120
    }
    else { 
    null 
    }
    
    0
    Comment actions Permalink
  • 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

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk