gibneyt
asked on
Assign SQL field to variable in Crystal Reports
I need to assign a field to a Crystal Reports Variable varSRPAWLaborRate. The following SQL SELECT statement returns the required correct data:
SELECT LABRAT_13
FROM SFC_Work_Center
WHERE (WRKCTR_13 = 'SRPAW')
I'm using CR 8.5 and need to run calculations using the variable.
What am I missing? TIA.
Tim
SELECT LABRAT_13
FROM SFC_Work_Center
WHERE (WRKCTR_13 = 'SRPAW')
I'm using CR 8.5 and need to run calculations using the variable.
What am I missing? TIA.
Tim
ASKER
That is a SQL statement from SSMS. I tried creating a formula in Formula Editor with the SELECT statement and get an error. I am missing some little nugget to get this to work.
Tim.
Tim.
ASKER
In CR Formula Editor I have:
numberVar varSRPAWLaborRate:= SELECT {SFC_Work_Center.LABRAT_13 }
FROM SFC_Work_Center
WHERE (WRKCTR_13 = 'SRPAW');
An error is thrown on check and puts the cursor back to the middle line just before SFC_...
<error>
Crystal Reports
!The remaining text does not appear to be part of the formula.
OK
</error>
numberVar varSRPAWLaborRate:= SELECT {SFC_Work_Center.LABRAT_13
FROM SFC_Work_Center
WHERE (WRKCTR_13 = 'SRPAW');
An error is thrown on check and puts the cursor back to the middle line just before SFC_...
<error>
Crystal Reports
!The remaining text does not appear to be part of the formula.
OK
</error>
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
mlmcc,
That is it! Thanks so much. Now to use the calculated number in the main report.
vasto, you were onto the SQL Expression so partial credit to you but mlmcc provided what would have taken me hours to figure out. Thanks just the same.
Tim
That is it! Thanks so much. Now to use the calculated number in the main report.
vasto, you were onto the SQL Expression so partial credit to you but mlmcc provided what would have taken me hours to figure out. Thanks just the same.
Tim
ASKER
mlmcc,
That is it! Thanks so much. Now to use the calculated number in the main report.
vasto, you were onto the SQL Expression so partial credit to you but mlmcc provided what would have taken me hours to figure out. Thanks just the same.
Tim
That is it! Thanks so much. Now to use the calculated number in the main report.
vasto, you were onto the SQL Expression so partial credit to you but mlmcc provided what would have taken me hours to figure out. Thanks just the same.
Tim
Tim, It is true that I mentioned SQLExpression, but I cannot consider this answer as helpful. mlmcc deserves the points.
Where is the variable?
DO you have a formula that declares it?
Just assign the value in there
mlmcc