0

Formula column in List view question

Hello!

I got tables Appointments, Treatments, Products.
Each Appointment can have one or more Treatment. In each treatment i can use one or more product.

In a list view of Appointments table i created a column with a formula to see in a glance what treatments were done in that visit and what products were used.

The formula is like this:
Treatment.Name + " done with " + Product.Name.
So, it gives me a text like: Lips done with Juvederm.

The thing is that when there are two treatments in one visit, the cell gives a text like:
LipsToxin done with JuvedermBotox.

As you see it pastes together two treatment names and two product names.
Can i make a formula to have a text like:
Lips done with Juvederm. Toxin done with Botox.?

7 replies

null
    • Agassi
    • 4 yrs ago
    • Reported - view

    Hello!

    In case, my question went down fast and unnoticed, i return to ask it. Please read my first post.

    • Agassi
    • 3 yrs ago
    • Reported - view

    Bump :(

    • Agassi
    • 3 yrs ago
    • Reported - view

    Thanks Sean!

    I suppose you mean the Join function.

    I tried it immediately after reading your  post, but have getting the error "Function is not defined: join(string,string) ..."

    Im trying to figure it out.

    In the thread you mentioned they also got this error, but i did not understand the reason yet.

    • Sean
    • 3 yrs ago
    • Reported - view

    Agassi, I don't think the join() function is going to work because you are trying to combine two separate arrays. This works, but might need a little tweaking...

     

    let tName := Treatment.Name;
    let pName := Product.Name;
    let arrCount := count(tName);
    let myString := "";
    for i in range(0, arrCount) do
    myString := myString + item(tName, i) + "done with" + item(pName, i) + " "
    end;
    myString

    • Agassi
    • 3 yrs ago
    • Reported - view

    Hello, Sean.

    Thanks for you help!!

    I made it with join. But there was a catch.

    As i said, Treatments (Tratamientos) is related to Appointments, and Products (Productos) is related to Treatments.

    I needed a formula in Appointments table.

    The code that worked is:

    join(Tratamientos.('Nombre tratamiento'.Nombre + " - " + Producto.'Article name'), " | ").

    But this code 

    join(Tratamientos.'Nombre tratamiento'.Nombre + " - " + Tratamientos.Producto.'Article name', " | ")

    does not work.  It gives the error "Function is not defined: join(string,string) ...".

    I spent a time tofigure it out why. Thanks to a sample from the thread you gave me. and the result i have is 

    Lips - Teosyal RHA1 | Chicks - Juvederm Ultra 4 | Chin - Juvederm Volift Retouch.

     

    Ill try your method also to learn Ninox more! Its so powerful!!

    Thanks again for your help!

    Agassi

    • Sean
    • 3 yrs ago
    • Reported - view

    Agassi, You're welcome.

    You actually didn't say, "Treatments (Tratamientos) is related to Appointments, and Products (Productos) is related to Treatments." 😉 No worries and you should probably ignore the code I posted above because it isn't for that data model. I did figure out how to nest join()'s and I'll post it in the other thread. Glad you got it working!

Content aside

  • 3 yrs agoLast active
  • 7Replies
  • 1303Views