I have 2 numbers, lets say “8” and “20”. How can I get a field to take those numbers and calculate all the numbers in between and inclusive… so the field should have 8:9:10:…:20?
I tried @DoWhile and @For, but I can’t seem to get it working…
Subject: RE: this one should be easy, but I’m dumb
thanks guys, I actually worked it out… almost Here’s how i did it…vars ‘sfw’ and ‘efw’ are numbers (not text)
n:=sfw;
@DoWhile(
weeks:= @Text(weeks):@Text(n) ;
n := n + 1;
n<= efw
);weeks
here’s why i say “almost”… sfw and efw are week numbers pulled by date… i.e. today is week# 8. I need to have the week numbers between two given dates… this code works fine, so long as the weeks are within the year… but what happens when the first “low” week number is “52”, and the “high” number is “3”… I’ll tell you what happens… al hell breaks loose!
Subject: RE: this one should be easy, but I’m dumb
As we know we are dealing with Weeks instead of just any numbers. The do this.
I would change the code as follows:
n:=sfw;
@DoWhile(
weeks:= @Text(weeks):@Text(n) ;
n := @modulo(n + 1;52);
n := @if(n=0;52;n);
n<>efw
);
weeks
if sfw=50 and efw=8
Modulo returns the remainder when divided by 52. Since 52/52 remainder is 0 we need a bit of a trick to say week 52 (alternatively I could have used 53 and handled n=0 set it to 1)