Display a maximum number of data
Hi!
I use a formula field to display text data which is itself from another formula field which contacts data.
I would like to find a solution to display only the last 5 lines and not all of them as currently.
Is it possible ?
Here is the code I am using:
join(Compte.'Historique des activités 1:N'.'Nom concaténé', "
")
Here is the current result:
Massage intuitif de 1:00 - Statut : terminé
Réflexologie plantaire de 1:00 - Statut : annulé par le client
Réflexologie plantaire de 1:00 - Statut : terminé
Réflexologie plantaire de 0:30 - Statut : terminé
Réflexologie plantaire de 0:30 - Statut : terminé
Réflexologie plantaire de 0:30 - Statut : terminé
Réflexologie plantaire de 0:30 - Statut : reporté
Réflexologie plantaire de 0:30 - Statut : reporté
Réflexologie plantaire de 0:30 - Statut : terminé
Réflexologie plantaire de 0:30 - Statut : reporté
Massage intuitif de 1:00 - Statut : reporté
Massage intuitif de 1:00 - Statut : terminé
Réflexologie plantaire de 0:30 - Statut : terminé
Massage intuitif de 1:00 - Statut : terminé
Thanks for your help
10 replies
-
Not sure how your tables are configured but this is something that could work:
let me := this let n := slice((select 'Historique des activités 1:N' where Compte = this) order by -number(Id), 0, 5); join(n.'Nom concaténé', " ")
-
beat me to it. again!
Here is another option.
said:
I use a formula field to display text data which is itself from another formula field which contacts data.My guess is that 'Nom concatene' is that formula field.
I would recommend you try the slice() command.
It could look something like:
let gatherData := Compte.'Historique des activités 1:N'; let cntgather := cnt(gatherData); let last5 := slice(gatherData, cntgather - 5, cntgather) join(last5.'Nom concaténé'," ")
This finds the last 5 records according to the default sort of record Id.
-
said:
I know there is something like "order by" but I don't know where to put it in the formula.You would need to order the initial gather of data.
let gatherData := (Compte.'Historique des activités 1:N' order by 'Date du rendez-vous');
said:
Status can be queried at: Compte.'Historique des activités 1:N'.'Statut' != 5Again you would filter at the initial gather step.
let gatherData := (Compte.'Historique des activités 1:N'[Statut != 5] order by 'Date du rendez-vous');
-
order by -number(Id) should work if the last record holds the latest date as in my example code.
-
Sébastien Guillet said:
I tried with rsort() but nothing worked.Yeah, you would think rsort() would take your sort order and reverse it, but it seems to reverse the record Id regardless of the original sort.
Luckily you can just put a minus sign in front of the field name after "order by". Yeah, it is that simple. It only works with number and date fields. It would look like:
let gatherData := (Compte.'Historique des activités 1:N'[Statut != 5] order by -'Date du rendez-vous');
If the records are in order but just in reverse to what you want then you can just change your slice:
let gatherData := (Compte.'Historique des activités 1:N'[Statut != 5] order by 'Date du rendez-vous'); let cntgather := cnt(gatherData); let first5 := slice(gatherData, 0, 5) join(first5.'Nom concaténé'," ")
Now you are getting the first 5 records.
Content aside
- Status Answered
- 1 yr agoLast active
- 10Replies
- 72Views
-
3
Following