Add a table with lots of rows

markdown10.4

 

Podio Calculation field makes use of Markdown features, so we are free to use them.

One of those features is to add a table: Let’s include a table with 20 rows and 3 columns. It is safe to add more columns.

Just copy paste the following code to a Calculation field:

/* @Any_Field */

var firstLine = [“”, “”, “”];
var seconLine = [“”, “”, “”];
var thirdLine = [“”, “”, “”];
var fourtLine = [“”, “”, “”];
var fifthLine = [“”, “”, “”];
var sixthLine = [“”, “”, “”];
var sevenLine = [“”, “”, “”];
var eightLine = [“”, “”, “”];
var ninthLine = [“”, “”, “”];
var tenthLine = [“”, “”, “”];
var eleveLine = [“”, “”, “”];
var twelvLine = [“”, “”, “”];
var thirtLine = [“”, “”, “”];
var forteLine = [“”, “”, “”];
var fifteLine = [“”, “”, “”];
var sixteLine = [“”, “”, “”];
var sevntLine = [“”, “”, “”];
var eigttLine = [“”, “”, “”];
var ninteLine = [“”, “”, “”];
var twentLine = [“”, “”, “”];

var start = “”;
var l = “\n:— | :— | :—\n”; 
var i = 0;

for(; i < firstLine.length; i++){
    start = start.concat(firstLine[i]);
    start = start.concat(” | “);
}
for(start += “\n”; i > 0; i –){
    start = start.concat(“:—|”);
}
for(start += “\n”; i < firstLine.length; i++){
    start = start.concat(seconLine[i]);
    start = start.concat(” | “);
}

if(thirdLine.length != 0){
    for(start += “\n”, i = 0; i < firstLine.length; i++){
        start = start.concat(thirdLine[i]);
        start = start.concat(” | “);
}   }
if(fourtLine.length != 0){
    for(start += “\n”, i = 0; i < firstLine.length; i++){
        start = start.concat(fourtLine[i]);
        start = start.concat(” | “);
}   }
if(fifthLine.length != 0){
    for(start += “\n”, i = 0; i < firstLine.length; i++){
        start = start.concat(fifthLine[i]);
        start = start.concat(” | “);
}   }
if(sixthLine.length != 0){
    for(start += “\n”, i = 0; i < firstLine.length; i++){
        start = start.concat(sixthLine[i]);
        start = start.concat(” | “);
}   }
if(sevenLine.length != 0){
    for(start += “\n”, i = 0; i < firstLine.length; i++){
        start = start.concat(sevenLine[i]);
        start = start.concat(” | “);
}   }
if(eightLine.length != 0){
    for(start += “\n”, i = 0; i < firstLine.length; i++){
        start = start.concat(eightLine[i]);
        start = start.concat(” | “);
}   }
if(ninthLine.length != 0){
    for(start += “\n”, i = 0; i < firstLine.length; i++){
        start = start.concat(ninthLine[i]);
        start = start.concat(” | “);
}   }
if(tenthLine.length != 0){
    for(start += “\n”, i = 0; i < firstLine.length; i++){
        start = start.concat(tenthLine[i]);
        start = start.concat(” | “);
}   }
if(eleveLine.length != 0){
    for(start += “\n”, i = 0; i < firstLine.length; i++){
        start = start.concat(eleveLine[i]);
        start = start.concat(” | “);
}   }
if(twelvLine.length != 0){
    for(start += “\n”, i = 0; i < firstLine.length; i++){
        start = start.concat(twelvLine[i]);
        start = start.concat(” | “);
}   }
if(thirtLine.length != 0){
    for(start += “\n”, i = 0; i < firstLine.length; i++){
        start = start.concat(thirtLine[i]);
        start = start.concat(” | “);
}   }
if(forteLine.length != 0){
    for(start += “\n”, i = 0; i < firstLine.length; i++){
        start = start.concat(forteLine[i]);
        start = start.concat(” | “);
}   }
if(fifteLine.length != 0){
    for(start += “\n”, i = 0; i < firstLine.length; i++){
        start = start.concat(fifteLine[i]);
        start = start.concat(” | “);
}   }
if(sixteLine.length != 0){
    for(start += “\n”, i = 0; i < firstLine.length; i++){
        start = start.concat(sixteLine[i]);
        start = start.concat(” | “);
}   }
if(sevntLine.length != 0){
    for(start += “\n”, i = 0; i < firstLine.length; i++){
        start = start.concat(sevntLine[i]);
        start = start.concat(” | “);
}   }
if(eigttLine.length != 0){
    for(start += “\n”, i = 0; i < firstLine.length; i++){
        start = start.concat(eigttLine[i]);
        start = start.concat(” | “);
}   }
if(ninteLine.length != 0){
    for(start += “\n”, i = 0; i < firstLine.length; i++){
        start = start.concat(ninteLine[i]);
        start = start.concat(” | “);
}   }
if(twentLine.length != 0){
    for(start += “\n”, i = 0; i < firstLine.length; i++){
        start = start.concat(twentLine[i]);
        start = start.concat(” | “);
}   }
start 

/* ——————————————————————————————————-

Created by BendixKiel ApS – Copenhagen based Podio Preferred Partner -with more than 6 years of experience in helping organizations implement Podio. Please feel free to contact us if you need help evaluate, structure or implement Podio in your organization.

BendixKiel ApS www.bendixkiel.org +45 71 99 05 80 anders@bendixkiel.org

———————————————————————————————————– */

 

And replace the @Any_field with any field of your app. (We just include a redundant @Any_field, in order to make Calculation field work.)

What is happening here? Don’t get confused with all that code! We are just going to change “firstLine”, “secondLine”, etc.

Let’s say that we want a table with two columns and twenty lines. So we are going to replace the “” of each line variable with our data. Again, the only part of code that we will change is the “firstLine”, “secondLine”, etc which is in the very beginning!

That’s how we have changed the beginning of the previous code:

 

/* @Any_field */

var firstLine = [“Text”, “Number”];
var seconLine = [“Zero”, 0];
var thirdLine = [“One”, 1];
var fourtLine = [“Two”, 2];
var fifthLine = [“Three”, 3];
var sixthLine = [“Four”, “4”];
var sevenLine = [“Five”, “5”];
var eightLine = [“Six”, “6”];
var ninthLine = [“Seven”, “7”];
var tenthLine = [“Eight”, “8”];
var eleveLine = [“Nine”, “9”];
var twelvLine = [“Ten”, “10”];
var thirtLine = [“Eleven”, “11”];
var forteLine = [“Twelve”, “12”];
var fifteLine = [“Thirteen”, “13”];
var sixteLine = [“Fourteen”, “14”];
var sevntLine = [“Fifteen”, “15”];
var eigttLine = [“Sixteen”, “16”];
var ninteLine = [“Seventeen”, “17”];
var twentLine = [“Eighteen”, “18”];

 

As you can see, we have removed every third element of each line, so now it has only two. That simply means that we will create a table with two columns.

Thus, the following changes in “Modify Template”

markdown10.1a

markdown10.1b

markdown10.1c

markdown10.1d

 

give us the following result

markdown10.2

 

Do you want less than 20 rows? Leave the last lines after your data empty. For example, if you want a table with 8 lines, then the beginning of the Javascript becomes like this:

/* @Any_field */

var firstLine = [“Text”, “Number”];
var seconLine = [“Zero”, 0];
var thirdLine = [“One”, 1];
var fourtLine = [“Two”, 2];
var fifthLine = [“Three”, 3];
var sixthLine = [“Four”, “4”];
var sevenLine = [“Five”, “5”];
var eightLine = [“Six”, “6”];
var ninthLine = [“”, “”];
var tenthLine = [“”, “”];
var eleveLine = [“”, “”];
var twelvLine = [“”, “”];
var thirtLine = [“”, “”];
var forteLine = [“”, “”];
var fifteLine = [“”, “”];
var sixteLine = [“”, “”];
var sevntLine = [“”, “”];
var eigttLine = [“”, “”];
var ninteLine = [“”, “”];
var twentLine = [“”, “”];

 

Make sure you replace @Any_field with any field of your app. That’s how the previous Javascript looks like:

markdown10.3

 

Do you want to add more columns? 
You can do that, but then you need to add more elements to each line. For example, if you want a table with 4 columns, then the beginning of the Javascript becomes like this:

/* @Any_field*/

var firstLine = [“Text”, “T e x t”, “T-e-x-t”, “Number”];
var seconLine = [“Zero”, “Z e r o”, ” Z-e-r-o”, “0”];
var thirdLine = [“One”, “O n e”, “O-n-e”, “1”];
var fourtLine = [“Two”, “T w o”, “T-w-o”, “2”];
var fifthLine = [“Three”, “T h r e e”, “T-h-r-e-e”, “3”];
var sixthLine = [“Four”, “F o u r”, “F-o-u-r”, “4”];
var sevenLine = [“Five”, “F i v e”, “F-i-v-e”, “5”];
var eightLine = [“Six”, “S i x”, “S-i-x”, “6”];
var ninthLine = [“”, “”, “”, “”];
var tenthLine = [“”, “”, “”, “”];
var eleveLine = [“”, “”, “”, “”];
var twelvLine = [“”, “”, “”, “”];
var thirtLine = [“”, “”, “”, “”];
var forteLine = [“”, “”, “”, “”];
var fifteLine = [“”, “”, “”, “”];
var sixteLine = [“”, “”, “”, “”];
var sevntLine = [“”, “”, “”, “”];
var eigttLine = [“”, “”, “”, “”];
var ninteLine = [“”, “”, “”, “”];
var twentLine = [“”, “”, “”, “”];

Make sure you replace @Any_field with any field of your app. You also need to add more empty elements “” in each of the unused line variables. That’s how the previous Javascript looks like:

markdown10.4

No comments yet.

Leave a Reply