Post

2 followers Follow
0
Avatar

Related Table with up to 30 items


Hi everyone,

I would like to know how to create a table, where the first field is an automatic progressive number generated with the function (i + 1), on a calculation field where, independently of the number of related items, a maximum of 30 are always displayed.
In the event that the number of items is less than 30 (for example 20) the calculation should still display the first 20 items and for the next 10 only the automatic progressive number.

Thank you

Claudio Calabrò

Please sign in to leave a comment.

2 comments

0
Avatar

HI Claudio,

var len = @all of whatever field.length < 30 ?  @all of whatever field.length : 30;
for(i = 0; i < len; i++){
and so on

Rainer

Rainer Grabowski 0 votes
0
Avatar

Hi Ranier,

this is my edited code

var a = @All of 08IS - Nome with nulls;
var b = @All of 08IS - Cognome with nulls;
var c = @All of 08IS - Ragione Sociale with nulls;

var d = @All of 08IS - Cognome with nulls.length < 30 ? @All of 08IS - Cognome with nulls.length : 30;

var linea = [];
for(i = 0; i < d; i++){
linea.push(b[i] + " " + a[i] + " | " + c[i]);
};
var linea = linea.sort();

var linea2= [];
for(var i = 0; i < linea.length;i++){
linea2.push((i+1) + " | " + linea[i]);
};


var linea3 = [];
for(var i = linea2.length; i < 30; i++){
linea3.push((i+1) + " | " + "___________________" + " | " + "___________________");};

"Nr | Allievo | Azienda \n" +
"--- | --- | --- \n"+
linea2.sort().join("\n")+

("\n") +

linea3.join("\n")

 

e questo è il risultato:

can you confirm the correctness?

Regards

Claudio Calabrò 0 votes