Allow users to select a custom report file

1 minute read time.

Printing reports in the VB UI is pretty straight forward and fairly well documented. You specify the report name in the RptName() function. Example:  RptName = "XXREPT01"

Then, create a section in the report descriptor file (the xxrpt.ini file) with the same name. The report descriptor file defines things like the parameters for the report. You have probably noticed that if you don’t have a section in the xxrpt.ini file with the correct report name, you get prompted for all the report parameters when printing the report.

By the way, I don’t think it’s specifically stated anywhere, but the report name has to start with the module prefix. Otherwise the UI can’t find the report descriptor and you get prompted for the parameters. So, a report name of “MYREPORT” won’t work – it must be “XXMYREPORT”.

But what if you want to allow the user to select a different / custom crystal report? Let’s say you have a text box called txtReport on the UI where the user can enter a custom report name. Just doing something like this won’t work:  RptName = txtReport.Text

The UI won’t be able to find the report descriptor and the user will be prompted for parameters. There is an undocumented solution though. Simply keep the original report name and append the custom report name in square brackets to the string like this:  RptName = "XXREPT01[" & txtReport.Text & "]"

This will allow the UI to find the report descriptor and will override the “crystal=“ line in the descriptor file with the custom file name.

Happy Coding!

John Paterson, CEO at Dingosoft
Visit my blog and find Dingosoft on Social Media:

  • Hi Spkrish. It is possible for there to be actual differences between the IDE and the production environment, but it's pretty rare. Eg: in Sage 300 2017 custom buttons in grid headers work fine in the IDE, but crash in the production environment. (Sage fixed this in the 2018 version - still hoping they will fix it in 2017). I normally only do regular SDK development - not customizations, however I do have one .exe that prints reports and it worked fine - so I've really not much experience in this area. You could try setting your exe to run as administrator if you haven't already. Also, I would try running the report from the Crystal designer in the production environment to see what happens. It could be a Crystal problem.




    ***  Check out our new Sage 300 Financial Reporter:  ***

  • Hi Guru,  I am facing an issue on customized AR Invoice Entry UI AR2100 in production environment and NOT in Dev environment.

    created it as a custom app EXE with the ID "RT" Created roto entry as 

    Roto file read as below
    RT2100 OBJECT RT2100.EXE

    entry in grp.dat to launch custom AR Invoice entry UI 
    program files folder: RT62A

    Dev Environment:
    Sage 300 ERP version 6.2
    MS SQL Server 

    Whenever, i am trying to print the Invoice using Custom UI File menu i am getting the below error and the program hangs

    "Sage 300 ERP UI Container has stopped working"

    Anyone please guide me where i am doing wrong.

    Please let me know if need any further information to investigate the issue.