Calc field reference to related app

Comments

6 comments

  • Rainer Grabowski

    Hi Michael,

    when you call the referenced items through @all of field c you get them as an array. The first element in this array is always the "oldest" item (it's the one with the lowest Unique ID). You get this item with

    @all of field c[0]

    The youngest item you get with

    @all of field c[@all of field c.length-1]

    Rainer

    0
    Comment actions Permalink
  • Michael Movitz

    Thanks Rainer.  I should have noted that the desired record in app A is not in a fixed order.  In fact, the record I'm referencing is in App B as a related/linked field.  I need to extract the value of Field C within that matching record.  Specifically:

    App A, record x, Field C value is what I want to obtain

    App B contains a relationship field linked to "App A" records

    I want to add a calculation field in App B to obtain Field C value when the linked record in App B matches the same record in App A.

    I hope that helps clarify.  Thanks again,

    Michael

     

    0
    Comment actions Permalink
  • Rainer Grabowski

    "when the linked record in App B matches the same record in App A."

    What's the matching criterion? 

    0
    Comment actions Permalink
  • Michael Movitz

    The matching criterion is a field in the record. My example is a database managing projects, deliverables, and tasks (each of these is an app, and each contains multiple records. Records are linked/related between apps (ie, a project has multiple deliverables and each deliverable has multiple tasks). Projects are the parent, deliverable = child, tasks = grandchild.

    Each app has a field called "title" and "priority".  The title of one project is "Project A", which has 3 deliverables ("1", "2,", "3").  "Project A" has a priority field value of "1".  Within "Project A", "Deliverable 1" priority field value is "2".  I want to add a field in the Deliverable App called "Project Priority" that references the priority field in "Project A".  So Deliverable "1" has 2 priority fields: its own deliverable priority = 2 and its referenced project priority = 1.

    Thank you again for your time and help!

    Michael

     

     

    0
    Comment actions Permalink
  • Rainer Grabowski

    If a Delivarable is connected to only 1 Project it 's simply

    @all of priority.toString()

    All Deliverables which are related to Project A will show the same value ("1" in your example) in their field "Project Priority".

    What I don't understand is: 
    "App A has 10 records and I want the value of Field C from record 1 only." (in your 1. posting). - @all of gets values omly form the 1 linked Project. 
    and: "when the linked record in App B matches the same record in App A." (in your 2. posting) - there is nothing to match it there's only 1 Project item related. 

    Rainer

    0
    Comment actions Permalink
  • Simon Midtgaard Guldberg

    Hi Michael and Rainer

    I have a similar need. In App 'Contact' I wish to search for the text 'xyz' in a text field 'Communication' in all related items from App 'Email' (in same Workspace).

    In Contact, I use (thanks to Rainer):

    var text = @All of Communication      [Email via Contact (incoming) type]
    text.indexOf("xyz") > -1 ? "Yes, XYZ found" : "No, not XYZ"

    But, even when I refresh a Contact that has this text 'xyz' in the Communication field of a related Email, the calculation does not find a match. In the Email App, I set up a similar calculation field to find 'xyz' in the Communication field on each email item, and this works fine. My guess is that in the Contact App I am not searching through all related Email items? I get an array as Rainer describes above, so maybe the search syntax must be different? Hope you have a good idea Rainer :)

    /Simon

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk