Pulling URL's and Duration fields from one app to another - HELP

Comments

4 comments

  • Rainer Grabowski

    Hi Justin,

    durations are parsed to hours in the calculation field: 1 day in duration field would be in the calculation field @duration -> 24 (hrs), 3 Minutes 12 Seconds in duration -> 0,0533 (hrs). You have to parse it to the time units you want. In your case (e.g. for 3 Minutes 12 Seconds in duration)

    var asSeconds= @sum of Duration*60*60; // hour value * min * sec = 172 seconds
    var min = parseInt(asSeconds/60); // divides result of asSeconds and takes only the integer = 3
    var sec = Math.ceil(asSeconds % 60); //divides result of asSeconds and takes only the remainder = 12. Math.ceil rounds it up to full seconds
    min + " min " + sec + " sec"
    The displayed resut would be: 3 Min 12 Sec. "@sum of " you can use if there's only one item related or if you really want the sum of all related items. If there are 2 or more items related and you want to show it for each item you have to use a for-loop.

     

    It's not possible to embed the youtube-link in a calculation field so that you can start and watch it in the item. That's only possible in a Link-field. Maybe you can use Podio Advanced -Flows or Globiflow to copy the link form one app to the other. 

    Rainer

    0
    Comment actions Permalink
  • Justin Dean

    Hi Rainer

     
    Thanks for this, i have tried putting this in the calculation field but its not working - sorry I’m not a programmer so I’m not quite sure if I’m doing it completely right to make the inputted time in a duration field in one app then show in another app…?
     
    In relation to URL problem i have simply put a URL field under the calculation field which shows the URL then i can just copy and paste, not ideal but it works…
     
    Look forward to hearing back from you.
     
    Justin
    0
    Comment actions Permalink
  • Justin Dean

    Hi Rainer

    Ok disregard my last mail...

    So I've put in @sum of Duration*60*60; // hour value * min * sec = 172 seconds

    However in the first app i have 10 Seconds but in the calculation field on the other app this shows as 10.08 ?

    Justin

    0
    Comment actions Permalink
  • Rainer Grabowski

    Hi Justin,

    it's couse of the rounding in Javascript: 10 sec = 0.0028 hrs 

    0.0028*60*60 = 10,08 

    You can try:

    var asSeconds= Math.round(@sum of Duration*60*60);

    This elimantes the decimals.

    And also in var sec use .round instead of .ceil

    Rainer 

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk