1. Eric Verhorstert
  2. PowerBuilder
  3. Tuesday, 2 January 2024 08:37 AM UTC

Powerbuilder 2022R2

If a column in a datawindows is destroyed I see a empty column ( "": null ) in the json export

Is there a way to avoid this?

Thanks

Eric

 

Simplified code:

lds.dataobject = 'dw_line'
lds.modify("destroy column cs_key")
lds.settransobject( sqlca )
lds.retrieve( )
lds.exportjson( false )

Eric Verhorstert Accepted Answer Pending Moderation
  1. Tuesday, 9 January 2024 09:21 AM UTC
  2. PowerBuilder
  3. # 1

Solved it by changing the order of the columns and export the data using parameter startcolumn

Comment
  1. Armeen Mazda @Appeon
  2. Tuesday, 9 January 2024 18:40 PM UTC
Thanks for sharing the solution!
  1. Helpful
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Thursday, 4 January 2024 14:32 PM UTC
  2. PowerBuilder
  3. # 2

Sounds like a possible bug.

Can you not simple search and replace "( "": null )" with "" ?

 

Comment
  1. Eric Verhorstert
  2. Thursday, 4 January 2024 15:15 PM UTC
Great idea. But, string handling is not the best part of Powerbuilder. Replacing 3 strings per line in 10000 lines might give a performance problem. I normally use the Chilkat stringbuilder object for string handling because of the speed and possibilities. But, in this case I am not able to use it. Lets try and see what happens.

  1. Helpful
  1. Miguel Leeuwe
  2. Thursday, 4 January 2024 15:56 PM UTC
you're right. Powerbuilder is horrible at string manipulations, but you could:

1. Use Blob variables and functions like BlobMid which will speed up things (Roland Smith on Topwizprogramming has some great code for that).

2. Or even better: Create a C# DLL to do the string manipulations and import it into a PB nvo.
  1. Helpful
  1. Miguel Leeuwe
  2. Friday, 5 January 2024 13:04 PM UTC
Eric,

Here's a link you might be interested in: https://community.appeon.com/index.php/qna/q-a/use-c-for-replace-function

It includes a little sample application.
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 2 January 2024 12:14 PM UTC
  2. PowerBuilder
  3. # 3

Hi Eric;

  Suggestion: Have you also tryed amending the DWO's SQL to drop the column in question before the Retrieve()?

Regards ... Chris 

Comment
  1. Eric Verhorstert
  2. Thursday, 4 January 2024 13:57 PM UTC
Hello Chris,



If I change the SQL statement in the SQLpreview event nothing is returned anymore. Probably the only solotion is to except that we need to have a copy of the dw's to handle the columns we want in the json. Also checked if it was possible to delete a item in the json but could not find anything.



Thanks

Eric
  1. Helpful
  1. Chris Pollach @Appeon
  2. Thursday, 4 January 2024 18:10 PM UTC
Hi Eric;

Yes, if the dynamic SQL changes do not meeting your processing challenge, then multiple tailored DWO's would be the next best thing.

Regards ... Chris
  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.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.