1. Joe Hess
  2. PowerBuilder
  3. Friday, 4 September 2020 13:22 PM UTC

I'm designing an invoice export feature that generates a PDF file for each selected invoice. The invoice form has a nested report to show the subtotal, sales tax, shipping charges, and invoice total along with a few other things. Although we are not quite ready to transition to web apis, I designed this to work the same way. I have an API that retrieves data for the invoices using a datastore, and returns the data in JSON format. I thought importing the JSON would cover everything, but I found out the JSON does not contain the data for the nested report.

 

I can reference the nested report as a DWObject, get the dataobject of the nested report, retrieve the data, and manually update the nested report.

Is there an easier way to do this? I tried GetChild, but I could not that to work even after setting the processing to 5 (Composite). I would think that exporting a datastore to a JSON should contain the data for the nested report. Importing the JSON should update the nested report. If I can do it manually, ImportJson should be able to do it.

 

Thanks

Joe

 

Ken Guo @Appeon Accepted Answer Pending Moderation
  1. Monday, 7 September 2020 07:11 AM UTC
  2. PowerBuilder
  3. # 1

Hi Joe,

 

PB doesn’t support the situation you described. Currently, we don’t have a plan to support this requirement.

If you are using a composite DW, then you can use GetChild to get the DataWindowChild object, and then do an ImportJSON for each DataWindowChild.

 

If you are using a nested report, as ImportJSON doesn’t support directly importing to a nested report nor does it support the GetChild method, it is therefore not supported.

Even though you manually changed processing to 5 and you can run GetChild, ExportJSON on DataWindowChild may not give you what you need, especially when the nested report is on the detail band.

 

Regards,

Ken

 

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Friday, 4 September 2020 16:28 PM UTC
  2. PowerBuilder
  3. # 2

Hi Joe;

    I would suggest opening a Support Ticket as an enhancement for this as a JSON extended feature.

Regards ... Chris

Comment
  1. Joe Hess
  2. Friday, 4 September 2020 16:39 PM UTC
Thanks, Chris.



Maybe you can answer this question. I was able to populate the nested report once. I made some changes. Now when I try to update a column in the nested report, I receive the error, "Error accessing external object property object." Here is the line of code:



dc_invoiceForm.Object.dw_2 [al_row].Object.invd_class_type [ll_row]



The nested datawindow is in a group trailer. In this case, I'm trying to print a single invoice with 8 lines. There is only 1 page. al_row = 8. ll_row = 1. If I change al_row to 1, I do not get the error. However, I do not get any data in the nested report. Thoughts on what I can look for?
  1. Helpful
  1. Chris Pollach @Appeon
  2. Friday, 4 September 2020 16:48 PM UTC
Yes, any secondary data or object in either the Header, Summary or Footer would be referenced as Row #1.

I wonder if writing the received JSON data - after parsing it out - to a few temporary DB tables and then issuing a DS.Retrieve (<args>) would be the better (easier) way to populate the DWOs?
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.