conditional calculation between 2 apps

Comments

3 comments

  • Rainer Grabowski

    HI Benny,

    the calculation is no problem, it could be something like this (where I assume that the birth date is in a date field):

    var bdplus = moment(@Your Birthdate field).add(30,"months")
    var registerdates = ["01/09/22", "07/11/22", "09/01/23", "27/02/23", "17/04/23","22/05/23"];
    date = ""
    for(i = 0; i < registerdates.length; i++){
        day = moment(registerdates[i],"DD/MM/YY");
        if(day >= bdplus){
           date = registerdates[i];
           break;
        }
    }
    date

    The question is, how you get the register dates from app 1. If you want to pull data from other items (in the same app or in another app) there must be a connection between the items via a relationship field. Do you have a relationship field in app 2 to app 1? If so how do you set the relation between the items? Do you use Podio Advanced workflows (aka Globiflow)? Is each registration date an own item in app 1? 
    I need to know these things for giving you the correct code. 

    Btw: In your example none of the 6 registration dates would be matched because (born on) 13/09/2021 plus 30 months = 13/03/2024 , not 2023 :) 

    Rainer

     

    0
    Comment actions Permalink
  • Benny Gommers

    Hi Rainer,

    Many thanks for your quick response :-) 

    As to what I understand from the syntax (and please correct me if I'm wrong) is that you declare the registration dates as hard variables in the coding, right? this means with your syntax there is no need for a second app. In the 2nd app, I only have 2 fields: the registration data (date) and a description (text). Nevertheless, if I only have to add a few new dates in the coding on a yearly basis, maybe this is easier to maintain than going through all the hassle of connecting 2 apps to each other? 

    I'm using Globiflow as well but was not yet able to figure out how I configure it correctly.

    P.S. you're absolutely right in my example the result would probably by NULL as I missed 1 year ;-) 

    Benny

    0
    Comment actions Permalink
  • Benny Gommers

    Hi Rainer,

    I tried your syntax (see screenshot) but as you already explained it didn't give me any results as the calculated date is beyond any of the hardcoded options. So, I added a fictive date 01/04/24 to the list which is beyond the calculation date to see whether he would return this date. Unfortunately, Podio is giving the following error message "Invalid value "01/04/24" (string): must be number" back.

    Can you point me in the right direction, please? 

    Many thanks ...

    B. 

     

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk