JS code example for accessing fields across apps with no relationship
I am trying to find some examples of JS snippets on Podio's website to use in an app calculate field. I have an app called Availability which provides the total available hours a developer has each sprint. We determine available hours at the beginning of each sprint. I want to be able to sum the total hours from the stories assigned to the developer for the active sprint and show in the availability to determine if the developer is overbooked. What I want to do is create an array that looks for the developer's name in the Stories app to sum the story estimate (hours) for the active sprint. Do you have any code examples I can use? For example, I was hoping to have something like this (syntax not correct): loop through (for loop) my Stories app using condition if (Stories[i].Sprint == # && Stories[i].story_owner = developer). During the loop, if this condition is met, then total_hrs = total_hrs + Stories[i].estimate. I looked around on the site a bit, but I wasn't sure how to reference another app to build an array. The Availability App is not a reference app in the Stories app. The only common item across the the two is the member (developer) in the workspace.
-
Hi Michael,
if you need to use data in a calculation that is not available directly from referenced item, you will need to create a "helper" field. In your case, you want to use data from Stories in Availability, but those are only indirectly connected via Developer. Thus, you need to add one or more helper-fields in Developer, which pulls the necessary data from referenced Stories-items. You can then use those helper-fields in calculations in the Availability app.
E.g. in the Developer app, create a helper-field "total active stories estimate", where you sum up all hours of referenced active story items. (You'll want to use the array "@All of estimate" here, which is an array of your estimate-field values from referenced stories. In addition, you will probably want to filter this array based on other criteria, e.g. if the story is active or not).
After you created this helper-field, you can access it from a calculation in the Availability app using "@All of total active stories estimate".
Hope this get's you started in the right direction.
Best,
Stefan
Please sign in to leave a comment.
Comments
1 comment