This one should be easy, but I'm dumb

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…

thanks, sorry for my dumbness

Subject: this one should be easy, but I’m dumb

Can you do an add (by 1) to the number until you reach your end number? I’m not an expert scripter either, so just an idea!!

Subject: this one should be easy, but I’m dumb

I’d do something like this:

minNum:=8;

maxNum:=20;

n:=minNum;

list:=0;

@While(n <= maxNum;

@If(n=minNum; list:=n; list:=list:n);

n:=n+1

);

list

Obviously field needs to be of type ‘Number’ with ‘allow multiple values’ checked.

Hope that helps.

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!

thanks for your responses

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)

50:51:52:1:2:3:4:5:6:7:8

Subject: RE: this one should be easy, but I’m dumb

if only life was so easy

some years have 53 “weeks” … iow 53 Saturdays, and you have to program for that possibility as well.

Subject: this one should be easy, but I’m dumb

Are the numbers, numbers or numbers in a text field? If text, we will need to make some changes below

Here is how I would do it . Assume the numbers are in fields called num1 and num2 and we want the result in num3.

ans := 0;

low := @if(num1 <= num2; num1; num2);

high := @if(num1 <= num2; num2; num1);

ans := low;

@for(x := low+1; x <= high; x := x +1;

num3 := num3 : x

);

Field num3 := ans;

I did the ans := 0 at the start to tell intepreter I want to work with numbers.

If num1 and num2 are text then I would add the following

n1 := @TextToNumber(num1);

n2 := @TextToNumber(num2);

and then use n1 and n2 where num1 and num2 are currenctly located.