Need help with sintax
I have three fields on my app. CATEGORY with 2 options "OK" & "NOT OK". the next field is NUMBER which is a filed where I will enter a number between 1 and 5 (1,2, 2,3 any number in this range), a third field is CALCULATION where in my head I need to say "if @Number<2 >=5 @Category='NOT OK' else OK', meaning that the status on the category option needs to be set us NOT OK automatically, does this make sense, can PODIO make this posible? later on I will create a workflow to send a notification to send me a message if CATEGORY is NOT OK.
Thanks
-
Hi Luis,
you cannot actually ASSIGN a value to the category field, but you can make the calculation output the result you want. This should work:
var num = @Number; if (num < 2) || (num >= 5) { "NOT OK"; } else { "OK"; }
Please note: this will output "NOT OK" for any number smaller 2 (i.e. num < 2) as well as numbers greater or equal 5 (i.e. num >= 5). -- That is how I understood your question...
Best,
StefandieKollaborateure.com - Podio Training+Consulting+Development English & Deutsch
-
Hello Stefan,
Thank you for your prompt reply.
missing somethign here, so basically the calculation will return a value but it will not trigger any change to values on the category field (OK & NOT OK), Is this correct?I am getting error message: Preview: Script syntax error: Unexpected token ILLEGAL.
Thanks
Luis -
Hi Luis,
The first time you run a calculation sets the field type; text, number, date etc. Quite often if you are experimenting with code you inadvertently output the wrong format.
To get around this problem, create a new calculation field and just output @A Text Field, save the template and go ahead with your calculation. From then on Podio will know that this calculation is a text field.
BTW, do you also need help with spelling? Your subject heading is quite amusing for an English speaker because you spell it syntax. ;-)
-
Hi Luis, my apologies for the language comment, it only makes sense to native English spellers.
It is possible to reference a numeric field (or a date, relationship, number field) and output the calculation in your choice of text, number, date
The trick is to avoid doing any output in the calculation while you are constructing it which is not the output field type that you need.
The safe way to make sure this happens is. Make a new calculation field and do a very simple one line fake calculation which outputs the type of data you want. So if you need your output to be text just do a @Text where "tect' s one of your text fields. Then save the template, reopen it and delete the @Text line. From now on this calculation is configured to output text.
Does it make sense?
Please sign in to leave a comment.
Comments
9 comments