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

Giving user options

Status
Not open for further replies.

f0rg3tfu1

MIS
Aug 25, 2004
103
US
Good afternoon all,

Crystal 10 with SQL 2000.

OK, we are using crystal enterprise to post reports for access by different departments.

Two departments want the same report sorted differently... on wants it sorted by Employee name, the other wants sorted by Employee number. Both Descending.

So what do you think, is this possible to make a paramater such as, "To sort by name type NAME, to sort by Nubmer type NUMBER". Then if the paramater value = NAME, I say in the record selection formula "IF (paramater) = NAME then {sort by EMPLOYEENAMEFIELD}"

If this makes sense does anyone have an idea how to do it?

Thanks once again for everyones help
 
Sure, it's a common enough request.

Create the parameter, and then create a group field of:

if {?MyParm} = "Name" then
{table.name}
else
picture(totext({table.employeenumber},0,""),"000000000000000000")

There are other means also.

-k
 
OK i rewrote the code you gave me to suit my needs:

if {?Sort Paramaters} = "Name" then
{imrpt_part_valuation.part_description}
else
picture(totext({imrpt_part_valuation.part_id},0,""),"000000000000000000")

But i am getting an error when i compile it...

"too many arguments have been given to this function"

Refering to : , 0, "")

Ideas?
 
Hmmm, works here using your syntax as:

picture(totext(12345,0,""),"000000000000000000")

What is the data type?

Another method is to create 2 group formulas, and each changes and gets suppressed based on the parameter.

if {?Sort Parameters} = "Name" then
{imrpt_part_valuation.part_description}
else
""

The other group formula would be:

if {?Sort Parameters} = "Number" then
{imrpt_part_valuation.part_id}
else
0

So insert a group for each formula, and then conditionally suppress each group header/footer sections using formulas such as:

{?Sort Parameters} = "Number"

the other would be:

{?Sort Parameters} = "Name"

-k
 
You don't really need the picture function. You could just use:

if {?Sort} = "Name" then
{imrpt_part_valuation.part_description} else
if {?Sort} = "Number" then
totext({imrpt_part_valuation.part_id},"0000000")
else ""

...where the number of zeros reflect the maximum number of digits in your partID. If the partID is already a string, then you would use:

if {?Sort} = "Name" then
{imrpt_part_valuation.part_description}
else
if {?Sort} = "Number" then
{imrpt_part_valuation.part_id} else ""

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top