Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: 2 nontrivial problems (for a Newbie) Post Reply Post New Topic
Author Message
Teddy
Newbie
Newbie


Joined: 28 Feb 2008
Location: Germany
Online Status: Offline
Posts: 1
Quote Teddy Replybullet Topic: 2 nontrivial problems (for a Newbie)
    Posted: 29 Feb 2008 at 3:04am
Hello!
 
I'm quite new to CR xi, so I ran into two problems:
 
1.)
I've got a table Tbl1 containing a field 'weight' and have to display it's value in two columns P and G in my report depending on a value of another table Tbl2 that is referenced by a foreign key field.
 
Tbl1:                                          TBl2:
...                                               ...
weight (int)                                loadstate_ID (int)
fk_loadstate_ID (int)                  loadstate_val (char(2))
 
 
If loadstate_val is 'P' the 'weight' should be placed in column P, if loadstate_val is 'G' in column G.
What could be the best way to do this? I tried to solve this by a SQL Command but found no way.
 
2.)
How can I pass the selected value of a parameter field to a SQL Command?
I tried 'Parameter Create' in CR's SQL Editor but I all i got is a second prompt?!
 
 
thanks, Frank
IP IP Logged
saoco77
Senior Member
Senior Member


Joined: 26 Jun 2007
Online Status: Offline
Posts: 104
Quote saoco77 Replybullet Posted: 29 Feb 2008 at 4:52am
Listed a couple of possible approaches to question 1 below -

1) Place the weight field in both columns P & G and then suppress the field based on the value of loadstate_val.

So in column P you would suppress the weight field using a formula similar to this {table.loadstate_val}="G"

2) Another approach may be to create 2 formulas one for column P and one for column G to display weight something along these lines

if {table.loadstate_val}="P" then
{table.weight} else 0

Hope this helps.

Sarah
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 29 Feb 2008 at 2:22pm
The trick with parameters for SQL is to NOT create them in the report and instead create them in the Command Editor when you create your SQL.  The Command Editor will then create the new parameter for the report. 
 
To use the parameter in your SQL, you don't use the normal parameter syntax for your database.  Instead, you use the Crystal parameter syntax which is "{?ParameterName}"  where you replace "ParameterName" with the name of the parameter that you've created.
 
-Dell
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.047 seconds.