1. Sivaprakash BKR
  2. PowerBuilder
  3. Tuesday, 14 July 2020 11:43 AM UTC

Hello,

Using PB 2017 R3, Postgresql 11

Table A:  Columns   Field1 varchar(20),   Field2 jsonb

Field2 value is updated through a tabular datawindow using exportjson to a string and setitem to Field2.  Works fine.

Need to print this Field2 value in a report.  Thought of working out with a nested report. 

How could I achieve it?

Happiness Always
BKR Sivaprakash

 

Ken Guo @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 15 July 2020 09:36 AM UTC
  2. PowerBuilder
  3. # 1

Hi Sivaprakash,

If your DW is nested DW, it doesn’t support the GetChild action, so it also can’t support ImportJSON.

Nested DW usually retrieves data via the Retrieve function. Nested DW also supports parameter and will be displayed into every main record line and it is mainly used for the master/detail report.                   

So I suggest you work it around via the following:

  1. Use Composite DW, get the Child DataWindow via the GetChild function, and then Import JSON to the Child DataWindow.
  2. Use FreeForm DW, insert this nested DW, and then retrieve the data via the Retrieve function.

 

Regards,

Ken

Comment
  1. Sivaprakash BKR
  2. Wednesday, 15 July 2020 10:33 AM UTC
The place where need to display the data is not possible with composite DW. We need to display the data at top right end corner, which is not possible with composite dw.
  1. Helpful
There are no comments made yet.
Kevin Ridley Accepted Answer Pending Moderation
  1. Tuesday, 14 July 2020 12:30 PM UTC
  2. PowerBuilder
  3. # 2

If it is a simple (flat) json string without nested arrays, you can get the json string from column 2 and put it in it's own datawindow or datastore using ImportJSON and then print.

 

Kevin

Comment
  1. Kevin Ridley
  2. Thursday, 16 July 2020 11:58 AM UTC
I'm confused now. You originally said "Need to print this Field2 value in a report. Thought of working out with a nested report". That doesn't sound like a requirement to me, it sounds like a design you came up with that doesn't satisfy the actual requirement. To me, it sounds like the requirement is to display both field 1 and field 2, and be able to print field 2 which is a json string. You don't say if the json string is a bunch of columns and values, or maybe an array of columns/values that you would like formatted by column. The solution will depend on whether you have multiple rows of field 1, and if the json can have multiple rows. Also not sure if you are displaying just the json string in field 2 or you want it formatted to display columns. If you want an all-in-one solution that allows you to display and print fields 1 and 2, you need to build a datawindow that has field 1 and all columns from field 2 and populate it manually. If you just want to print field 2 formatted, then take the json from the selected row, put it into a datastore and print the datastore.



Don't confuse requirements with design. Requirements will say "I need to see these fields on this page: x,y,z. I need to be able to add new xyz, update yz, and delete a row, etc". Requirements do NOT say "put a nested datawindow inside datawindow 1 in the top right corner". Letting users decide where data goes is fine, but don't let them tell you that you have to use a nested datawindow.
  1. Helpful
  1. Sivaprakash BKR
  2. Thursday, 16 July 2020 13:18 PM UTC
Sorry if I'm confusing. Something that assumed that others know. When I told that Field2 is jsonb field, entered in a tabular dw, I assumed that other could understand that there may be more than one row and more than one column.



When I tried the suggested solution, to put two dw's in a composite and then finally in a freeform, I'm not satisfied with the outcome. The data are not at the proper place to make the report better.



May be the place, 'top right corner', might have shown my interest, but one could understand that difference exists in nested as well as composite report's outcome.



Since I could not achieve the desired result, I came up with some more details. That's all.

  1. Helpful
  1. Kevin Ridley
  2. Thursday, 16 July 2020 13:47 PM UTC
LOL! A tabular dw can have 1 or more rows, so multiple rows is an important piece of info. Either way, I gave you a solution that will work. If you don't want to use it, that's up to you. You should consider being more polite to people that are trying to help you instead of trying to make them sound dumb by saying you assumed someone could understand. People are more likely to help when you are polite. I'm done on this one, good luck.
  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.