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, "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.".
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 "a number, currency ammount, boolean or string is expected here" 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 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 "crystal syntax" rather than "basic syntax". That's really all I can figure out. If you have it set to basic then I really can't find anything else wrong.
Add "Else "Failed" 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 "Failed"?
You may have some null values that are disturbing your logic.
If IsNull({HOSPITAL.HOSPITAL_NAME}) then
"No Hospital name"
Else If IsNull({STUDENT.LASTNAME}) then
"No Student name"
Else If {HOSPITAL.HOSPITAL_NAME} = {?Hospital} then
{STUDENT.LASTNAME}
Else
"Wrong Hospital" Malcolm
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.