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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Concatenate issue

Status
Not open for further replies.

munchen

Technical User
Aug 24, 2004
306
GB
I am using crystal XI.

I have two fields {tblA.year} and {tblA.period}. They are both strings.

I want to concatenate these strings like so: {tblA.year} & '/' & {tblA.period} and say call this field {@Period}

Then I need to have something like so in the rpt selection formula:

{@Period} >= 200310 and {@Period} <= 200411

This isn't working as I want as crystal sees 20032 as greater than 200710 and 20049 as being greater than 200410.

Anyone know a way round this?

Do I have to convert using tonumber?
 
Try:

{tblA.year} & totext(val({tblA.period}),"00")

If you are not comparing the value to a value containing "/", then don't add it in. Your record selection would look like this though:

{@Period} >= '200310' and
{@Period} <= '200411'


-LB
 
If {@Period} is
Code:
{tblA.year} & totext(val({tblA.period}),"00")
then your selection formula should be similar with this:
Code:
ToNumber(Replace({@Period},"/","")) >= 200310 and
ToNumber(Replace({@Period},"/","")) <=  200411
To compare them as numbers instead of strings.

-------------------------------------------------------------------------------------------------------------------------
"Now I can look at you in peace; I don't eat you any more." Franz Kafka, while admiring fish in an aquarium
 
Except you wouldn't need the replace() if there were no "/".

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top