separated number

Printed From: Crystal Reports Book — Forum Name: Technical Questions

Hi,
I need to make a number into some variable. for example : 1234
I need to make it into :
var1=1
var2=2
var3=3
var4=4

Does anyone have a solution?

thx,

Joe
It could be interesting.  I would assume that the number is always the same length.  Thus you could change the number to a string, use string functions to break up the number then covert it back to number.

I.e.,
local stringvar tempvar;
local numbervar var1;
local numbervar var2;
local numbervar var3;
local numbervar var4;
tempvar := cstr({somefield});
var1 := cdbl(left(tempvar,1));
var2 := cdbl(mid(tempvar,2,1));
var3 :+ cdbl(mid(tempvar,3,1));
var4 := cdbl(right(tempvar,1));