Java script for changing categories into percentages
Please help! I need to change 5 categories into a percentage in a calculation field. I have 5 fields with a yes/no/NA answer and need the yeses automatically converted into a percentage excluding the N/A answers at the bottom. I can then use this data through Globiflow to create team averages on the answers across the organisation each week. I don't know anything about Java at this time (although am keen to learn). Any help would be massively appreciated.
-
Hi Yohan,
is b the "content" of a category option (= a string)? E.g. if you have a category field with options like 10%, 20%, 25%, 30%.
And do you want a) to multiply 200 * 25 = 5000, or b) to get 25% of 200 = 50?If b is a string, you can do for a):
a = 200
b = @category field
c= parseInt(b.replace(/%/,""),10)
Math.ceil((a*c),0)for b):
Math.ceil(a*c/100)Rainer
Please sign in to leave a comment.
Comments
3 comments