Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Modify a selection formula parameter? Post Reply Post New Topic
Author Message
Rand
Newbie
Newbie


Joined: 27 Oct 2011
Online Status: Offline
Posts: 5
Quote Rand Replybullet Topic: Modify a selection formula parameter?
     Posted: 15 Jul 2013 at 1:14pm
I'm working on a report where one of the database fields is a sequential ID set as a string type and in the format of "0000000000". I want to run the report based on a user selected ID, so for the time being I've created a parameter value with a default the same as above, so the user can delete the last few 0's and enter their number.

But is there anyway I can change it so they can just enter the number? So basically what I'm trying to do is:

1. In the default Crystal Parameter screen the user enters a number, such as: {?param} := '1234'
2. Some code converts that to a string and appends the correct number of zero's on front making it: StringVar modParam := "0000001234"
3. In the selection formula I use this new 10 character string to select my records: modParam = {db.ID}

But the record selection formula doesn't like me entering any non-selection specific code in it. I know there are a few functions for determining when to calculate a formula (EvaluateWhilePrinting... etc) but I don't think any of these can apply to the selection formula.

So is there anything I can do or am I out of luck here? It's not that big a deal really but it would be a nice little convenience if I could do this.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 16 Jul 2013 at 3:58am
is this single select or multi select?
single select is pretty straight forward
totext({?param},"0000000000",0,"") = db.id
 
 
or you coud rverse the logic to
?param = tonumber(db.id)
IP IP Logged
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