Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I change the data type of a formula field

Status
Not open for further replies.

willz99ta

IS-IT--Management
Sep 15, 2004
132
US
Hi,

I am trying to change the data type of a formula field from number to string. I am using Crystal 11.

The reason I am trying to do this is because it won't let me create a variable that ends with a string without it.

The error is "a number is required here" when I try to save the formula field.

Thanks [again if it is lbass],
Will
 
create a formula: totext({your field}) and use this in your formula.
 
Nope that doesn't fix it -- I still get the same error.

My formula field (now) is:

if Month 9{REQLINE.CREATION_DATE})=10 then
{REQLINE.REQ_NUMBER} else
totext({@null})

BTW: The variable null is blank. I am doing this to get a distinct count of REQLINE.REQ_NUMBER for October.

The error is still: "a number is required here" when I try to save the formula field. It highlights totext({@null})

I need to change the data type of the entire formula field somehow (so it does not expect a number at the end).


Thanks again,
Will
 
I fixed the problem by changing my formula to:


if Month ({REQLINE.CREATION_DATE})=10 then
cstr({REQLINE.REQ_NUMBER}) else
{@null}

The cstr function converted the field to a string type. Maybe this was what tsouth was suggesting earlier with the totext function.

Will
 
You could have used:

if Month ({REQLINE.CREATION_DATE})=10 then
{REQLINE.REQ_NUMBER} else
tonumber({@null})

You have to convert {@null} to the same datatype as the other field, unless it is a string.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top