Writing Code
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Writing Code
Message Icon Topic: Code help Post Reply Post New Topic
Author Message
rockMEhardplace
Newbie
Newbie


Joined: 15 Nov 2016
Online Status: Offline
Posts: 1
Quote rockMEhardplace Replybullet Topic: Code help
    Posted: 15 Nov 2016 at 11:54am
Hoping you guys/gals can help me. I'm trying to sort some information in order, but my information is a bit complicated.

Here is an example of some numbers I want to sort:

15-203 0-1
15-20012 0-5
14-9880 2-14

-The number before the dash represents a year (2015, 2014)
-The after the dash but before the space represents what number case we're on that year (203rd case, etc)
-And the numbers after the space refers to specific items (for which I still need sorted, but have no bearing on the case #)

My issue is, the numbers above are string fields and although I've converted them tonumber fields, they are not sorting correctly.

For instance: 15-203 refers to the 203rd case of the 2015 year, and 15-20012 represents the 20,012th case we had in 2015. They belong nowhere near each other, but because they both start with 20, they are being sorted that way. I need it to sort according to ones, tens, hundreds, thousands place.

Here's what I had so far:

if len({case})<1 then ({case})

else

mid({case}, 1)&

If isnumeric (mid({case}, 4) ) then
              
tonumber (mid({case}, 4)) &

Replace(Replace(CStr({case}), ',', ''), '.00', '')

I was told to use the formula below to do what I need to do, but it's not working:

if instr( {Customer.Customer Name}," ") > 0 then
mid ( {evlocal.localid} , 1, instr( {evlocal.localid}," ") - 1 )

Any help would be so appreciated! Thank you!


IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.017 seconds.