Problem with a list of numbers...should be an easy one

hi folks,

can’t get that to work since an hour…so may be you see more then I do.

f_n:=“Untitled”;

rem{“i have 3 fields, Untitled1-3 and my_value is a number”};

@For(n := 1;n <= 3 ;n := n + 1;

my_value:=@GetField(f_n+@Text(n));

my_list_of_numbers:=my_list_of_numbers : my_value

);

rem{“now my_list_of_numbers should look like 1:2:30 if the values in the three fields were 1,2, 30”};

@Prompt([Ok];“”;@Text(@Elements(my_list_of_numbers)))

what am i doing wrong here?

i always get an "incorrect data type: text expected.

my fields DO have numbers like default value=1, 2 ,30

thanks in advance

alex

Subject: Problem with a list of numbers…should be an easy one

this appears to work fine:

f_n:=“Untitled”;

@For(n := 1;n <= 3 ;n := n + 1;

my_value:=@GetField(f_n+ @Text(n));

my_list_of_numbers:= @Trim(my_list_of_numbers : @Text(my_value)));

@TextToNumber(my_list_of_numbers)

Subject: RE: Problem with a list of numbers…should be an easy one

you are my man!

that works great.

what i’ve done in addition is setting this up with my rest of code and getting a nice little cummulation formula.

f_n:=“fldFCSM”;

@For(n := 1;n <= 12 ;n := n + 1;

my_list_of_numbers:= @Trim(my_list_of_numbers : @If(n!=1;@Text(@GetField(f_n+ @Text(n)) + @TextToNumber(my_list_of_numbers[n-1]) );@Text(@GetField(f_n+ @Text(n)))))

);

@TextToNumber(my_list_of_numbers)

may be someone can use this too :wink:

thanks again.

Subject: Problem with a list of numbers…should be an easy one

Alex,

Perhaps on the first pass you should simply set my_list_of_numbers to itself, and then append on future passes. It may be that it’s trying to concatenate a number to the initial blank value of the variable.

regards,

raphael

Subject: Problem with a list of numbers…should be an easy one

If I right understand you, the fields Untitled1, Untitled2 and Untitled3 have number type.So, you can do next:

  1. change type of field to strign

  2. change string

my_list_of_numbers:=my_list_of_numbers : my_value

on

my_list_of_numbers:=my_list_of_numbers : @Text(my_value)