0

Wanting a single record instead of the array.

I am using this reference in a formula field :

(select ContactTypeJoinTable)[text(ContactTypeChoice.Category) = "Supplier"].Contact.Company

In my formula field I now get all records of 'Company' with "Supplier" as 'Category'. How do I constrain it to the one record that is linked to this record?

4 replies

null
    • Ninox partner
    • RoSoft_Steven.1
    • 4 yrs ago
    • Reported - view

    Try using first() in your code(code goes betweed brackets)

    Steven.

    • Devloo
    • 4 yrs ago
    • Reported - view

    Thanks but first() gives me the same result in all my formula field records, ie the first one. I am wanting the unique linked reference for each record.  

    • Mconneen
    • 4 yrs ago
    • Reported - view

    @Devloo... you need to add a condition to your where/ evaluation clause that checks that.     For example, assume a model where a Parent has 0 to many Child records..  (we will not worry about a many to many with this example.. you should get the idea). 

    If you select Child[age > 10] ... it will return ALL children who are over 10.. regardless of parent..  

    Assuming you are on the Parent record .. something like.. 

    select Child[Parent = this and age > 10] should work... 

     

    That said.. there are times.. and I do not recall the specifics.. that I have had to do something like

    select Child[number(Parent.Id) = number(this.Id) and age > 10]

    • Devloo
    • 4 yrs ago
    • Reported - view

    Thanks for the help! It ended up working with:

    let myId := this.Id;
    (select ContactTypeJoinTable)[Type = number(myId) and text(ContactTypeChoice.Category) = "Supplier"].Contact.Company;

Content aside

  • 4 yrs agoLast active
  • 4Replies
  • 1202Views