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!

Formula Advice Needed

Status
Not open for further replies.

kc27

Technical User
Sep 10, 2008
171
US
Hello

I am using Crystal Reports 9 to create a report. This report returns rows of events. On each row is the event name, a production code number used on that event, a job step number that is due for that event, and a description that corresponds that describes the job step.

Where I am getting stuck is that I need a way to tell Crystal Reports to look at the production schedule code for the event in each row, then apply the production schedule code, for example "XLM2" just to that row. Then for the next row, check the production schedule code for that row, and apply the code.

If I just have a single event, it's easy to create a filter like this one {dflt_prdctn_schdl.prdctn_schdl_cd} = "DPS2" What I do not know how to do is to create a formula when my report contains multiple events and requires a forumula that looks at the prdctn_schdl_cd for each row, then applies that code to that row.

Hopefully my description makes some sense. Any ideas on this would be appreciated.
 
You can add the same table twice, the second time as an "Alias" that is treated as if it were distinct. Does this help?

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 2008 with SQL and Windows XP [yinyang]
 
Madawc

Thanks, I appreciate the help. How would I use the alias to determine the prdctn_schdl_cd for each row, and then applying it to that row? Or am I making this more complicated than it has to be?
 
The Alias can be selected for just the value you want. Provided it is always there for anything you want to report: it gets more complex otherwise.

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 2008 with SQL and Windows XP [yinyang]
 
You do not need to add in the table mre than once, it is only linked to the same colum {dflt_prdctn_schdl.prdctn_schdl_cd} each time.

You will however need to creat a formula to handle each {dflt_prdctn_schdl.prdctn_schdl_cd}

This is not very efficient as if you ad new codes the report will have to be adjusted. Idaelly there should be another table which converts each {dflt_prdctn_schdl.prdctn_schdl_cd} to the date you require.

Failing that your formula will look something like

@Prod Schedule
If {dflt_prdctn_schdl.prdctn_schdl_cd} = "DPS2" then "result 1......" else
if {dflt_prdctn_schdl.prdctn_schdl_cd} = "DPS3" then "result 2....." else
......

Ian

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top