Reserved Order Number Report in API

Discussions related to Crystal Reports development.

Moderator: Lisa Ennis

Post Reply
KWoods
Posts: 10
Joined: Tue Aug 27, 2019 12:26 pm

Reserved Order Number Report in API

Post by KWoods »

Is there a way to generate the Reserved Order Number Report(DOC_SPUNR_ReservedOrdersByProjectID) in the API? I am able to generate a report by using a GUID from a previously generated report, but would like to be able to generate the GUID in the API and then get the report using that new GUID. Is this possible or can the report only be generated in the API by using a GUID from a previous report?
Lisa Ennis
Posts: 84
Joined: Thu Sep 11, 2008 1:57 pm

Re: Reserved Order Number Report in API

Post by Lisa Ennis »

The DOC_SPUNR_ReservedOrdersByProjectID report is used in the Reserve Order Numbers wizard (accessed from the "Create New Items" button). The wizard generates a new guid for the project id and the report prints from the wizard. I do not work with the API to be able to provide any assistance with that other than to say I believe the API would need to generate the new project id the same way the wizard does.
Lisa Ennis
Senior Report Developer
SoftPro
KWoods
Posts: 10
Joined: Tue Aug 27, 2019 12:26 pm

Re: Reserved Order Number Report in API

Post by KWoods »

I did get this figured out. I had to Create the reserved orders using an OrderReservation and OrderReservationBatch. Added the OrderReservationBatch to the OrderReservation and then created with the IOrderStore. Pertinent bits below:

IOrderStore os = userObject.sps.GetService<IOrderStore>();
OrderReservation res = new OrderReservation();
OrderReservationBatch resbatch = new OrderReservationBatch();

resbatch.Count = 10;//number of orders to reserve
resbatch.Profile = pm.ActiveProfile.ID;

DateTime dt = DateTime.Now;
res.Project = "LoadTestTest" + dt;
res.Suffix = "AU";
res.TrustAccountID = tiInfo.ID;
res.Batches.Add(resbatch);

IReserveOrdersResult order = os.ReserveOrders(res);

string ProjectID = order.ProjectID.ToString();
Post Reply