Print Page | Close Window

separated number

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=22707
Printed Date: 29 Apr 2024 at 3:11am


Topic: separated number
Posted By: joekanant@gmail
Subject: separated number
Date Posted: 06 Dec 2018 at 3:18am
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



Replies:
Posted By: kevlray
Date Posted: 06 Dec 2018 at 4:53am
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));





Print Page | Close Window