Showing result in calculation field based on category field result
I'm trying to set up a calculation in Podio which works based on the result of a category field - this should be simple but the category field is not coming up in my list of fields for the calculation.
I want the calculation to be:
If @Qualifications required == "Yes" {
@quals.join()
} else {
"N/A"
The @quals.join() field is to pull the information from another app.
However - when I start typing the calculation, the @Qualifications field shows as a text field, not a category, and if I continue, I get an error message "Preview: Script syntax error: Unexpected identifier"
What am I doing wrong? It's not a vital piece of code, since it will only echo information in the selected field which should only be filled in for those who need it, but it's frustrating that I can't work this out. I've exited the app template and created a fresh calculation field several times, all with the same result.
One other related question I have - I have formatted a date field which is being pulled through, but if the field in question is empty, I get "Invalid date" showing - is there a way to set this to show "N/A" if empty?
moment(@All of Date Teacher Status checked with nulls.join()).format("D MMM YYYY")
-
Hi Susan,
is "Qualifications required" a field in the same app where you have the calculation field? If so it's strange that it doesn't show up. Did you save the app template (without calculation field) before you tried to build your calculation? If you want to pull data from a field in another related app you have to pull it with @all of field name.
Also your IF syntax is wrong:var result = "";
if(@Qualifications required == "Yes") {
result = @All of quals.join();
} else {
result = "N/A"
}
resultIf it still doesn't work attach screenshots, please.
Rainer -
Regarding your other question:
Do you usemoment(@All of Date Teacher Status checked with nulls.join()).format("D MMM YYYY")
in a for() loop with multiple related items or do you pull always one related item (= one date) only?
If one item only:var date = @Max of Date Teacher Status Checked;
date != "" ? moment(date).format("D MMM YYYY") : ""If in a loop I need to see the whole calculation (screenshot).Rainer -
Hi Rainer
Thank you - I knew I was wrong somewhere in my IF statement but couldn't figure it out! I think part of it is that i was expecting to see something other than the "A" denoting a text field, for the category field in the calculation, which threw me.
Also I realised after I'd sent this post that I've already figured out how to do the "N/A" for the date as I'd done it elsewhere on the same template - just hadn't read that far down the page! Thank you for the fix though, it's the same as I'd already done. :D I am learning!
I did figure out a workaround for it but it wasn't as simple or elegant as the code you gave / I already had!
All sorted - I will try and remember that category fields show as text type for the purposes of a calculation (of course they do!).
Please sign in to leave a comment.
Comments
3 comments