1. Sivaprakash BKR
  2. PowerBuilder
  3. Tuesday, 24 January 2023 03:05 AM UTC

Hello,

PB 2022 B 1892

In one of my projects, ImportJSONByKey fails to import data when run from exe.  The same JSON string imports successfully when run from the IDE.  The command used to import JSON is

li_rc = ids_setup.ImportJSONByKey(ls_ret_json, ls_error) 
If Trim(ls_error) <> '' Then MessageBox('Error', ls_error)

No error gets displayed and li_rc returns 0 [zero].

This issue is only when running from exe.

Verified:
1.  That the runtime path points to the correct PB runtime folder.
2.  Installed the runtime and application in another computer.  The same issue.
3.  Replacing ImportJSONByKey To ImportJSON(ls_ret_json) works successfully in both Exe mode and IDE mode.  
4.  Created a separate test project, with the same JSON string and datawindow. It imports successfully.
5.  Tried importing one single record [original returns 20 records].  It also fails with ImportJSONByKey command.   

Any idea how to debug this issue?

Happiness Always
BKR Sivaprakash

 Update :  Same JSON could be imported into a datawindow successfully.  It fails when importing it into a datastore.

Armeen Mazda @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 24 January 2023 17:35 PM UTC
  2. PowerBuilder
  3. # 1

If you have reproducible test case and want to open a support ticket, our team would be happy to double-check that this is not a bug.  

Comment
There are no comments made yet.
Sivaprakash BKR Accepted Answer Pending Moderation
  1. Wednesday, 25 January 2023 14:20 PM UTC
  2. PowerBuilder
  3. # 2

Thanks Armeen,

Found the issue.   There is a custom pb.ini file [ borrowed from STD-FC) which contains the following settings.

[DataStore Behavior]
; No = do NOT use MS-Window handles in DS processing (Default is yes). "No" gives much better performance!
UseHwnd=no

With the above settings, 

ImportJSONByKey    Fails   

ImportJSON            Succeeds

Commenting out the above code, things started working perfectly.

This should be bug, but before opening a support ticket, would like to confirm here.

Attached is a PB 2022 project, with the pb.ini that's been borrowed from STD-FC.  

1.  Exe file has been renamed to import32.exe.one.   Rename it to import32.exe
2.  Run the attached exe.  Issue is when run from exe alone.  Works perfectly when run from IDE.

Button 1 : Import JSON By Key, imports the data into first datawindow.  It works irrespective of the settings in pb.ini

Button 2 : Import JSON imports the data into the last datawindow. It works irrespective of the settings in pb.ini

Button 3 : Import JSON By Key [Datastore] which gives  the no. of rows imported message.  It fails when UseHwnd=no is enabled in pb.ini

Button 4 : Import JSON [Datastore] also gives the no. of rows imported message.  It works irrespective of the settings in pb.ini

Happiness Always
BKR Sivaprakash

 

Attachments (1)
Comment
  1. Miguel Leeuwe
  2. Wednesday, 25 January 2023 19:18 PM UTC
I've updated my info on https://www.pb.miguell.work/pb-ini/list-entries and hope Appeon does the same on their site.
  1. Helpful 3
  1. Benjamin Gaesslein
  2. Thursday, 26 January 2023 08:10 AM UTC
Interesting that ImportJsonByKey fails but ImportJson works as expected. I'm guessing there's some additional processing involved that relies on Windows-handles. Have you tried wether or not ImportRowFromJson works with UseHwnd=No?
  1. Helpful
  1. Sivaprakash BKR
  2. Friday, 27 January 2023 05:09 AM UTC
Benjamin,

ImportRowFromJSON works irrespective of settings UseHwnd
  1. Helpful 2
There are no comments made yet.
Sivaprakash BKR Accepted Answer Pending Moderation
  1. Friday, 27 January 2023 05:13 AM UTC
  2. PowerBuilder
  3. # 3

Added ImportRowFromJSON button for checking

Here I've attached the PB 2022 project.

Exe file has been renamed to import32.exe.one.   Rename it to import32.exe.

ImportRowFromJSON works irrespective of the UseHwnd settings.

Happiness Always
BKR Sivaprakash

 

Attachments (1)
Comment
There are no comments made yet.
Sivaprakash BKR Accepted Answer Pending Moderation
  1. Monday, 30 January 2023 11:20 AM UTC
  2. PowerBuilder
  3. # 4

Support Ticket Opened

https://www.appeon.com/standardsupport/track/view?id=9668

Happiness Always
BKR Sivaprakash

 

Comment
  1. Armeen Mazda @Appeon
  2. Monday, 30 January 2023 17:06 PM UTC
Great, thanks!
  1. Helpful
There are no comments made yet.
Matt Balent Accepted Answer Pending Moderation
  1. Monday, 30 January 2023 21:33 PM UTC
  2. PowerBuilder
  3. # 5

I have run into this same issue off and on for at least 18 months in 2019 R3

Comment
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.