table from @all of calculation field
app a: client roster with 1 field: 1) text field of client name
app b: list of canceled appointments with 3 fields: 1) relationship to client roster, 2) relationship to employee roster, 3) date field (date of canceled appointment)
want to create a calculation field in app a to give me all the canceled appointments for that client broken down by month in chronological order. when i do @all of.join() i get a list of raw dates. any chance i can get a table that looks something like:
November 2015: x cancelations
December 2015: x cancelations
January 2016: x cancelations
February 2016: x cancelations
-
Hi Mike,
with @all of you get an array, .join() makes this array a string. For your wanted calculation you don't need a string, but the array.
var arr = @All of Date of Appointment;
var arrClean = []
for (var i = 0; i < arr.length; i++){
arrClean.push(moment(arr[i]).format("YYMM MMMM YYYY"));
};
var arrSort = arrClean.sort();
var count = 1;
var results = "";
for (var i = 0; i < arrClean.length; i++)
{
if (arrClean[i] === arrClean[i+1])
{
count +=1;
}
else
{
results += arrClean[i].substr(5) + ": " + count + " cancelations\n";
count=1;
}
};
results -
w3schools is great, many,many examples you can find in stackoverflow.com (some times very advanced stuff) - best friend is google search (w3schools- and stockoverflow-links are most time at the top).
Please sign in to leave a comment.
Comments
4 comments