Need help with query input parameters

#1
Hi all, I'm very new to Progress OpenEdge... so I hope I'm in the right spot.

I work for a school district that uses Skyward as a student information system. Skyward uses Progress OpenEdge database. I'm trying to create a query with input parameters for a Crystal Report. I just want to copy/paste my query into Crystal. I have no problems connecting Crystal Reports to the Progress DB via ODBC.

My problem is that I cannot figure out how to use parameters in a query in Progress. I just want to do something really basic like this (in T-SQL):

Code:
DECLARE @School_ID int;

SELECT FirstName, LastName
FROM Students
WHERE School_ID = @School_ID;
How do I write a similar query in Progress?
 

Osborne

Active Member
#2
The Progress version of the above would be something similar to:
Code:
DEFINE INPUT PARAMETER pSchool_ID AS INTEGER NO-UNDO.

FOR EACH Students WHERE Students.School_ID = pSchool_ID NO-LOCK:
   DISPLAY Students.FirstName Students.LastName.
END.
 
#3
Thanks for the reply, Osborne!

When I try your syntax, I get the following error:

SQL Error [S1000]: [DataDirect][ODBC Progress OpenEdge Wire Protocol driver][OPENEDGE]Syntax error in SQL statement at or about "DEFINE INPUT PARAMETER pSchool_ID AS INT" (10713)
 

Osborne

Active Member
#4
I seem to have misunderstood your request, as thought you wanted the Progress version of the SQL code but the error message seems to indicate you are still working in SQL. If that is the case then not sure the answer as never used Crystal Reports.

Can you create parameter fields in Crystal Reports, and if so I think the SQL required may be something like this:
Code:
SELECT "Students1"."FirstName", "Students1"."LastName"
FROM "DBName"."PUB"."Students" "Students1"
WHERE "Students1"."School_ID"=pSchool_ID
 
#5
Osborne, you were correct. I need the Progress version.

I don't know what I'm doing with Progress... so I may need the "explain like I'm 5" answer.

I'm using DBeaver to write my queries. I'm connected to the Progress database using ODBC. I'd like to be able to just copy my query from DBeaver and paste it into Crystal Reports. I've done that successfully with queries that do not use input parameters. However, trying to use a parameter in a query gives me the error every time in DBeaver.
 
Top