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!

Select Expert

Status
Not open for further replies.

savok

Technical User
Jan 11, 2001
303
AT
Does anyone know of any tutorials or examples on the web on how to use select expert? I am totally new to CR and I am forced to use it ;)

I am trying to get the table.name field to show up where table.hospital = the parameter hospital

plz help
 
It might be easier to insert a forumla field into your report rather than using the select expert in this case. On the menu at the top, go to insert formula. It'll open the insert field window. Right click on formula and click new (or ctrl N). Click "basic syntax" on the drop down window. In the box type the following:

IF <table.hospital>=?parameter THEN Formula = table.name

You can type IF then click on the database fields in the upper left window to insert the fields and parameter values into the formula if you want.

Then you can insert this formula field that you've created into the spot where the table.name database field was originally. Basically, this formula field says, &quot;I'm the table.name field so long as the table.hospital field for this record is equal to the parameter entered by the user.&quot;.

Hope this helps. I know it sounds long but it should take 2 or 3 minutes tops.

:)
 
Ok i think i get what you mean but when i tried doing it i got an error saying &quot;a number, currency ammount, boolean or string is expected here&quot; and it pointed at Name

If {HOSPITAL.HOSPITAL_NAME} = {?Hospital} Then Name = {STUDENT.LASTNAME}

Name is what i named the formula, what am i doing wrong?
 
i redid it like this but then it says a formula can not refer to it self either directly or indirectly


If {HOSPITAL.HOSPITAL_NAME} = {?Hospital} Then {@Name} = {STUDENT.LASTNAME}
 
CrystalVisualBOracle if i rename Name to Formula = i still get the same error
 
Okay so you're formula now reads exactly as follows correct? And you have the syntax as basic?

If {HOSPITAL.HOSPITAL_NAME} = {?Hospital} Then Formula =
{STUDENT.LASTNAME}
 
yes thats what it is, i still get the error &quot;a number, currency ammount, boolean or string is expected here&quot; and it points at Formula
 
I recreated the same formula here using different table and the only way I get the error you have is when the syntax list box at the top of the window is set to &quot;crystal syntax&quot; rather than &quot;basic syntax&quot;. That's really all I can figure out. If you have it set to basic then I really can't find anything else wrong.

Can anyone else out there shed any light on this?
 
hmm where is the syntax list box? i dont even see it
I am using version 7
 
I have CR8 so there in lies the problem. Look for a &quot;Formula Language&quot; option up in the menu or toolbar area.
 
looking with no luck, anyone with version 7 have a clue where it is?
 
Okay I found that you can only use Crystal Syntax so lets do that

Replace your text with
If {HOSPITAL.HOSPITAL_NAME} = {?Hospital} Then {STUDENT.LASTNAME}
 
hmm no errors now, but when i put it in the report nothing shows up ;)

thanks for all your help by the way ;)
 
Add &quot;Else &quot;Failed&quot; to your formula statement so you can tell if it's failing the condition in the formula. For example, once you add the else clause does it still return nothing or does it read &quot;Failed&quot;?
 
nope nothing happens still, doesnt give me Failed

If
{HOSPITAL.HOSPITAL_NAME} = {?Hospital}
Then
{STUDENT.LASTNAME}
Else
&quot;Failed&quot;
 
You may have some null values that are disturbing your logic.

If IsNull({HOSPITAL.HOSPITAL_NAME}) then
&quot;No Hospital name&quot;
Else If IsNull({STUDENT.LASTNAME}) then
&quot;No Student name&quot;
Else If {HOSPITAL.HOSPITAL_NAME} = {?Hospital} then
{STUDENT.LASTNAME}
Else
&quot;Wrong Hospital&quot; Malcolm
 
Malcom I put it in exactly as you said and still nothing happens, i am probably making some stupid mistake somewhere else
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top