This is a migrated thread and some comments may be shown as answers.

Running report from Progress 4GL language

1 Answer 193 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Dariusz
Top achievements
Rank 1
Dariusz asked on 17 Dec 2019, 01:27 PM

Hi all,

I'm looking for example code to call/render report stored at Report Server from Progress 4GL language (Progress v.11.5, AIX box) and save it somewhere as .PDF file.

Hope what I want is possible.

Thanks.

1 Answer, 1 is accepted

Sort by
0
Neli
Telerik team
answered on 20 Dec 2019, 11:42 AM

Hello Dariusz,

You can utilize the RS web API to request and get the reports from any environment. For further information, visit the following articles:

- POST api/reportserver/v2/documents;

- GET api/reportserver/v2/documents/{documentId};

- HOW TO RUN A TELERIK REPORT FROM ABL?

You can use the code below:

const string REPORT_NAME = "ExampleReport1";
static void Main()
{
    ExecuteSampleScenario();
}

public static void ExecuteSampleScenario()
{
    var settings = new Settings()
    {
        BaseAddress = "http://reportserver:83"
    };

    using (var client = new ReportServerClient(settings))
    {
        client.Login("admin", "111111");
        var documentBytes = ExportDocument(client);
        File.WriteAllBytes($@"C:\temp\{REPORT_NAME}.pdf", documentBytes);
        System.Diagnostics.Process.Start($@"C:\temp\{REPORT_NAME}.pdf");
    }
}

/// <summary>

/// Creates a single-format document and gets its bytes

/// </summary>

/// <param name="client"></param>

/// <returns></returns>

static byte[] ExportDocument(ReportServerClient client)
{
    var existingReport = client.GetReportInfos().Single(r => r.Name == REPORT_NAME);
    var model = new CreateDocumentData
    {
        DeviceInfo = new Dictionary<string, object>(),
        Format = "PDF",
        ParameterValues = new Dictionary<string, object>(),
        ReportId = existingReport.Id,
    };
    var documentId = client.CreateDocument(model);
    return client.GetDocument(documentId);
}
}

 

Regards,
Neli
Progress Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Dariusz
Top achievements
Rank 1
Answers by
Neli
Telerik team
Share this question
or