Post

3 followers Follow
0
Avatar

Counting projects for timesheet app

I have a timesheet app for my weighted blanket business. For each blanket, there's an initial sewing stage and a finishing sewing stage. They both make the same amount, but that amount differs depending on what size blanket they sew ($20 each stage for adult, $15 each stage for child, etc). I did have it set up to compare the names listed under "Initial sewer" and "Finishing sewer" for each referenced blanket, and if they were the same, it would add 2 to the count, or 1 to the count if they were different. For some reason, it stopped working and was getting mixed up with other sizes. It wasn't recognizing that the two were ==.

So I changed it so it didn't rely on the names in the initial and finishing sewer fields and instead added a field to the blanket pages that they would change to either "Full" or "Split" and if it's Full, it'll count +2 for the blanket, or +1 if it's split.

"Lap Pads" field is a relationship field with reference to the blanket app (view filtered w/ only lap pads).

"Total Lap Pads" calculation field that references the "Lap Pads" field with code...

var type = @All of Size;
var fullsplit = @All of Done fully by one sewer or split;
var count = 0;
for(i = 0; i < type.length; i++){
  if(fullsplit == "Full") {
    count += 2;
  } else {
    count += 1;
  }
};

But it's not calculating it correctly. I have one timesheet with two blankets, one that's split and one that's a full, but it's still showing 2 instead of 3.

Any ideas?? Thank you!!

Rebecca Crockett

Please sign in to leave a comment.

2 comments

0
Avatar

Hi Rebecca,

there's a mistake in your code,it must be fullsplit[i] in the if.

Rainer

Rainer Grabowski 0 votes
0
Avatar

Oh jeez, I'm sure I tried that but there must have been something different wrong when I did. It's all still a little bit Chinese to me, hehe. Thank you! That worked perfect :D You're a lifesaver!

Rebecca Crockett 0 votes