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

Pull specific amount of digits only.

Status
Not open for further replies.

zfge01

Technical User
Jul 24, 2007
9
US
I have a site id field. I need to limit my report to show only those sites that are 6 digits longs. Nothing more, nothing less. How can I accomplish this?
Thank you.
 
I do not have crystal in front of me, so apologize for any syntax/brain drain errors.
depending on your field type, something like below in the selection expert may fit your needs:

len(TRIM(totext({table.field})))=6

 
My field is 10 digit string
return values with no selection criteria look like this:
5712019
4000417
5712010
350351
48201
385401

so I want I want is to not show site id's like the first 3 listed here. Just site ids that are ONLY 6 digits long.
I tried your formula in the editor and pulled the field in so I would not have a typing mistake, Errored out for invalid field. I only have one database selected. so it is not a join.
 
try creating a formula

//{@stringlength}
len(TRIM({table.field}))

if your field is already a string, you will not need to 'totext' part.

then in your select expert, set the formula to "is equal to" 6.
 
Nevermind, I just redid it and it worked. Thank you for the formula.
Don't know why it didnt work the first few times, But it does now
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top