1. Haihong Yang
  2. PowerBuilder
  3. Tuesday, 8 December 2020 15:27 PM UTC

Hi,

We are using PowerBuilder client to connect to Asp.net web API service. But when we export the datawindow to Json, we have issue with serializing date format. In PowerBuilder, the format is yyyy-mm-dd HH:mm:ss. But ISO format is yyyy-mm-ddTHH:mm:ssZ. It does not match the ISO format and cannot be serialized. Does anybody know how to solve this issue?

Thanks

Haihong

 

     

Govinda Lopez @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 8 December 2020 16:00 PM UTC
  2. PowerBuilder
  3. # 1

Hi Haihong Yang,

 

What version/build of PowerBuilder are you using? If I can recall, this was modified in a version of R2.

 

 

Regards,

Comment
There are no comments made yet.
Haihong Yang Accepted Answer Pending Moderation
  1. Tuesday, 8 December 2020 16:08 PM UTC
  2. PowerBuilder
  3. # 2

Govinda,

Thank you. We use PB 2019 Build 2170.

Comment
  1. Govinda Lopez @Appeon
  2. Tuesday, 8 December 2020 16:25 PM UTC
Haihong Yang,



We would recommend that you update to the latest supported version: PowerBuilder 2019 R2 build 2353 (https://www.appeon.com/update). This version includes enhancements done to the .NET DataStore (https://www.appeon.com/company/news/appeon-releases-powerbuilder-2019-r2-automated-c-migration-solution.html).



Even better, we have released the Beta version for PowerBuilder 2019 R3. You could test that one out and see if it suits you better. The GA release is close now.



Regards,
  1. Helpful
There are no comments made yet.
Armeen Mazda @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 8 December 2020 16:34 PM UTC
  2. PowerBuilder
  3. # 3

Hi Haihong,

Is the DataWindow control in PowerScript doing the export JSON or is it the .NET DataStore in the ASP.NET Web API doing the export JSON? 

It would be best you provide sample code of what has problems so we are in better position to help you.

Best regards,
Armeen

Comment
There are no comments made yet.
Haihong Yang Accepted Answer Pending Moderation
  1. Tuesday, 8 December 2020 16:55 PM UTC
  2. PowerBuilder
  3. # 4

Armeen,

We use PowerScript to export Json. Following is the code sample.

 

 ls_data = ldw_DWToSave.ExportJson(TRUE, FALSE)
           
 li_return = gn_RESTClient.SendPostRequest(ls_url, ls_data, ls_response)

 

Result of ExportJson:ls_data:

 


[{"su_subs_id":17235,"pa_dep_no":"00","dxid":671,"dxid_desc56":"                                                        ","revision_no":null,"diagnosis_source_cd":"PR","diagnosis_bus_process_cd":null,"diagnosis_status_cd":"A","phpd_comments":null,"row_eff_dt":"2020-12-01 00:00:00","row_exp_dt":null,"phpd_lupd_ts":"2020-12-07 20:07:43.319000","phpd_lupd_oper_cd":"ROMANENB","delete_dt":null,"delete_oper_cd":null,"delete_reason_cd":null,"icd_count":null,"icd_cd":null,"icd_desc":null}]

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 8 December 2020 17:48 PM UTC
  2. PowerBuilder
  3. # 5

Hi Haihong;

   Unfortunately, PB's current support for DateTime in the DWO and JSON generator objects is UTC format only. The JSON generator can do UTC by timezone as well. Other DT formats are not supported.

  My suggestion for now would be to either a) parse out the DT format in the exported datastream replacing the UTC with ISO format or b) define the DT output field as string and format it yourself for ISO compliance under PowerScript control.

Regards ... Chris

Comment
  1. Armeen Mazda @Appeon
  2. Tuesday, 8 December 2020 18:18 PM UTC
Adding to what Chris said, you can use the JSON parser & generator to get the data out and then rebuild the JSON.

Parser - https://docs.appeon.com/pb2019r2/objects_and_controls/ch02s48.html

Generator - https://docs.appeon.com/pb2019r2/objects_and_controls/ch02s46.html
  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.