0

how can I count the different value of a row(select)

Hi

I need count the different values of a select, i have a principale table "Event" with a composition table "temps", in the table table "temps"i have a row " climat" type select, and i want count for a row "Event" how many row i have with the value 3.

i make a formula and this formula return the total for all Event row.

let myID := number(ID);
let myTemps := Temps;
if Temps then
cnt((select Temps)[Climat = 3])
else
0
end

i search to add the conditions with same Event.id but dont works the value return 0

let myID := number(ID);
let myTemps := Temps;
let tID := Temps.Event.ID;
if Temps then
cnt((select Temps)[Climat = 3 and myID = tID])
else
0
end

what is the right code to use?

 

thank you

2 replies

null
    • Database Consultant
    • Kirkness_Associates_Ju
    • 5 yrs ago
    • Reported - view

    Hi David

    I have a similar structure - Events and Bookings in my case with a Status field agains the booking where option 3 is 'Confirmed'. Here's a formula that worked for me:

     

    let thisEvent := this;
    count(select Bookings where Events = thisEvent and Status = 3)

    Hope this helps!

    Julian

    • davidperrino
    • 5 yrs ago
    • Reported - view

    It works, thanks you so much

    Bye

Content aside

  • 5 yrs agoLast active
  • 2Replies
  • 1803Views