WB19 - passing variable to report - SQl doesn't recognize it

Startbeitrag von Joel am 03.01.2015 16:24

Hi -

I pass a variable to a report like this:
PROCEDURE RPT_BirthdayNote(grpar_Month, grpar_Header, grpar_Message, grpar_Image)

Then I try to use it in a SQL statement like this:
grsSql is string = [
SELECT
*
FROM
gpsdContacts
WHERE
bActiveMembershipFlag = 1
AND
WL.DateToString(dDOB,'MMMM') = grpar_Month
]

HExecuteSQLQuery(grsdDataSource,grsSql)

And the Execute fails, says it doesn't recognize the grpar_Month variable. What is the correct syntax for this?

Antworten:

Hi,
you can use sql in reports i guess but I never do that.

I create the query. Make it availeble for reports and queries. Add the parameters to the query then in the report:

Procedure reportname ( passedvar1 , passedvar2 )

query.param1 = passedvar1
query.param2 = passedvar2
hexecutequery ( queryname, hdefault)

If you do it this way you can test your querie outside the report to see if it does what it is supposed to do .

Regards

Allard

von Allard - am 03.01.2015 18:02
Hi Joel

WL.DateToString(dDOB,'MMMM') = '%1'
]
grsSQL = StringBuild(grsSQL,grpar_Month)
HExecuteSQLQuery(grsdDataSource,grsSql)


David

von David Egan - am 03.01.2015 18:34
Hi and thank you Allard -

I have to use SQl b/c I'm not using an Analysis - I've created a bunch of Data Sources so I don't need to have an analysis in every project. That way - I have one project with an analysis and just update that one if need be. Don't have to open everyone and update each. It was getting to be a pain.

I took a bit to figure out how to create a report with the SQL data source built in, but now that I've got it, it's all pretty straight forward.

Thanks and be welL!

Joel

von Joel - am 03.01.2015 20:26
Thanks David -

I knew that! Just haven't used it enough to keep it in memory.

Thanks!

J

von Joel - am 03.01.2015 20:45
Hi,

I use queries in reports quite extensively and implement them as per Allard's description.

von DarrenF - am 03.01.2015 21:16
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.