calculation referenced fields and sum if

Comments

5 comments

  • Rainer Grabowski

    Hello Christophe,

    I assume B1 is a number field and B2 and A2 are both single choice category fields. If so, this should do it:

    var b1 = @all of field B1;
    var b2 = @all of field B2;
    var a2 = @a2;
    var sum = 0;
    for(var i = 0; i < b1.length; i++){
    if(b2[i] == a2){
    sum += b1[i];
    }};
    sum

    Rainer

    0
    Comment actions Permalink
  • Paulo Berger

    Thanks for this so quick reply, but as mentioned as I am doing my calculation from the app A, I cannot call the variable (or fields) from the app B. How can I call B1 and B2 fields (belonging to app B in another workspace) from my calculation field in app  A?

     

    thanks. 

    0
    Comment actions Permalink
  • Rainer Grabowski

    Are the 2 apps related through a relationship field? If you want to pull data from other app items, A-item and B-items must be related. I'm afraid you don't have a relationship between these apps (it doesn't depend on where the apps are, in the same workspace or in another workspace)

    0
    Comment actions Permalink
  • Paulo Berger

    Thanks again Rainer. 

    I just related the apps altogether and this is better. But the bad side is that I have to relate all entries from app B for the calculation to be able to work. So it means, each time that I want one item from app B to be added (in the calculation field), I need to add that item first to the relationship field, which is not very convenient. 

    I wish that I could just establish a general relationship with between the 2 apps and not having to select all items for the calculation to occur. Is there a way to fix this?

     

    thanks

    0
    Comment actions Permalink
  • Rainer Grabowski

    A general relationship is not possible, it must be an item to item relation. Many Podio-User use Globiflow to relate the items automatically on creation of an item. If you have the relationship field in App B you can make it required, so that the item creator is forced to add it to an A-item. Another option is to have an App C with only 1 item and to connect all A -and all B-items to this C-item. This way I connect several 1000 items from > 30 apps (which are not connected directly) and pull data from any app in any other app. But that's a bit advanced stuff. 

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk