• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1360
  • Last Modified:

Using the CurrentCEUserName function in a Crystal Report

I have a field called UserName which includes the firstintial last name field from a table called Store.
This matches the CurrentCEUsername from Crystal Resports Server that identifies our users.
The report I am working with is needing a group by store.
The report has to be set up so only the manager of the store sees the data from the his own store.
The tables that are involved are called Store and Users. They are linked by the STORE_ID.
 
How can I create a group that will match the CurrentCEUsername when the report should only show the the group value for the Store location. Like California Store or New York Store or Florida Store.

How do I make the CurrentCEUserName responsible for supressing a section when there is no relationship in the to the {store_id} other than the link between the tables.
I know where to put it in the Section Expert | Suppress Condition Box but not sure of the formula.
Now there is one manager per store in te near future we will have more than one manager per store how would that change the formula?
0
ruavol2
Asked:
ruavol2
  • 2
  • 2
  • 2
2 Solutions
 
mlmccCommented:
You can try something like this

CurrentCEUserName = {UserNameField}

mlmcc
0
 
ruavol2Author Commented:
What about if there is a range or several different managers.comming out of a field. I think I got that one it was the second part of that question that was tougher for me.
0
 
ruavol2Author Commented:
For mlmmc:
My problem is different the client has the username that would match the CurrentCEUserName
what I do not know how to do is they have a store and a maager say
Store Name = Manager FirstIntial Last Name
California     = TCruise
Washington = BGates
Oregon        = BSaxton
Nevada        = FSinatra
What I do not know how to do is realate that to the store. How do I make this work if I have no relationship to the store name which in this case would be California, Washington,Oregon or Nevada.
Do I create a group with some kind of weird formula in it I am wondering if the database will need to be modified in order to make this happen. How do I say this store group equals the (CurrentCEUsername ={myfieldusername}) I do not know what I have to do? Please advise.
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
frodomanCommented:
Hi ruavol2,

>>> How do I make this work if I have no relationship to the store name

The simple answer is that you can't.  In order to make this work you will need to establish this relationship somehow.  You could create a complicated formula in your selection formula e.g.:

  (CurrentCEUserName = 'TCruise' and {Store} = 'California')
  OR
  (CurrentCEUserName = 'BGates' and {Store} = 'Washington')
  ...etc...

This means that your report changes everytime this relationship changes.  I would recommend creating a table in the database that contains this mapping (e.g.:  TCruise = California, etc.).  You can then add this table to your report - probably as the primary table and join your other tables to it.  Add a filter in your select expert to this table:

  {RelationShipTable.UserName} = CurrentCEUserName

This will restrict the entries in this table to only the appropriate person and the join between this table and the others (join on state or store name or whatever) will insure all of the data from other tables is only for the correct store.  Another advantage is this same structure allows you to let one person view multiple stores.  If there is a manager just add them multiple times to this table:  (BMan = California, BMan = Oregon   <-- That would let Big Man see both states without any changes to your report).

HTH

frodoman
0
 
frodomanCommented:
Regarding your posted comment (http://www.experts-exchange.com/Community_Support/General/Q_22745615.html) - be assured it isn't anything personal.  There aren't many people that respond routinely in this forum.  You'll get better response in the "Crystal Reports" forum generally.  

As you noted, mlmcc is by far the most prolific responder and he knows his stuff so speaking for myself, when I see he's responded to a question I generally assume it's under control and move on.  Also, most experts only look at the most recent postings so if a question has gone stale it may be advisable to post a new 25 point question that points to the original with a plea for help - experts that missed the original question will be prompted to go back and look at it.

Cheers,

frodoman
0
 
mlmccCommented:
Glad i could help

mlmcc
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now