Macro printing Report still prompt for Connection Auth & Parameter

SUGGESTED

Hi All,

I have problem with printing report from macro. 

this is my code in macro

this is my parameter in the Crystal Report and this is the only parameter.

But it still prompt for connection authentication and parameter

Is there any other thing that should be done? Thank you.

Parents
  • 0

    Are you using ODBC - SQL Native 11?

    Did you edit this file as a user that is an admin?  I had a problem with this.  If I edited as a user that was not an admin (window domain), it worked. 

  • 0 in reply to imScott

    Hi Scott,

    to solve the auth problem, use SQL authentication in your Crystal database connection.

    To solve the parameter prompt problem, I add the parameters in the icrpt.ini. Example below:

    [ICCONNOTE]
    heading=52300
    crystal=ICCONNOTE
    orientation=portrait
    paper size=1
    optparams=5
    2=TRNSFROM              STRING 52301
    3=TRNSTO                STRING 52302
    4=SWPRINTED             STRING 52303
    5=QTYDEC                STRING 52304
    6=INCLSERIALLOTNUMBERS  STRING 52305 

    To print the report, I just set value to the parameters. Example below. I am printing the report from macro.

    def printReport(self, dntext):
    	#showMessageBox("dn.value={};".format(dntext))
    	rpt = Report()
    	rpt.reportName = "icconnote[icconnote.rpt]"
    	rpt.destination = "preview"
    	#rpt.printDirectory = "D:\\NKS\\{}.pdf".format(dntext)
    	rpt.setParameter("TRNSFROM", dntext)
    	rpt.setParameter("TRNSTO", dntext)
    	rpt.setParameter("INCLSERIALLOTNUMBERS", "0")
    	rpt.setParameter("SWPRINTED", "1")
    	#rpt.setParameter("QTYDEC", "4")
    	rpt.orientation=1
    	rpt.paperSize=9
    	rpt.paperSource=1
    	rpt.print(self)

Reply
  • 0 in reply to imScott

    Hi Scott,

    to solve the auth problem, use SQL authentication in your Crystal database connection.

    To solve the parameter prompt problem, I add the parameters in the icrpt.ini. Example below:

    [ICCONNOTE]
    heading=52300
    crystal=ICCONNOTE
    orientation=portrait
    paper size=1
    optparams=5
    2=TRNSFROM              STRING 52301
    3=TRNSTO                STRING 52302
    4=SWPRINTED             STRING 52303
    5=QTYDEC                STRING 52304
    6=INCLSERIALLOTNUMBERS  STRING 52305 

    To print the report, I just set value to the parameters. Example below. I am printing the report from macro.

    def printReport(self, dntext):
    	#showMessageBox("dn.value={};".format(dntext))
    	rpt = Report()
    	rpt.reportName = "icconnote[icconnote.rpt]"
    	rpt.destination = "preview"
    	#rpt.printDirectory = "D:\\NKS\\{}.pdf".format(dntext)
    	rpt.setParameter("TRNSFROM", dntext)
    	rpt.setParameter("TRNSTO", dntext)
    	rpt.setParameter("INCLSERIALLOTNUMBERS", "0")
    	rpt.setParameter("SWPRINTED", "1")
    	#rpt.setParameter("QTYDEC", "4")
    	rpt.orientation=1
    	rpt.paperSize=9
    	rpt.paperSource=1
    	rpt.print(self)

Children
No Data