1. André Rust
  2. PowerBuilder
  3. Friday, 28 July 2023 07:32 AM UTC

Hi
I have an existing GRID-DW. This is to be extended at runtime by 1-n field(s) including SQL part.

If the SQL part, with the extension, does not work, then the data for the new field should be inserted manually. It is then a computed column field.

How can I extend the syntax of the existing DW at runtime?

Has anyone done this before and can give me examples.

Thanks a lot.

Many greetings
André

John Fauss Accepted Answer Pending Moderation
  1. Monday, 31 July 2023 14:21 PM UTC
  2. PowerBuilder
  3. # 1

Hi, André -

Many years ago I had a similar requirement, and I opted to dynamically construct the entire syntax for the DataWindow to satisfy the run-time conditions. This worked very well.

DW complexity can vary greatly, I realize, but if you are able to omit all or most of the "fluff" syntax (such as all of the gradient-related syntax, for instance), this might be a viable option. DW syntax is relatively simple and straightforward, and much of the DW syntax PB generates is related to default properties and likely can be omitted. Experiment and find the minimal syntax that works for you.

Best regards, John

Comment
  1. André Rust
  2. Tuesday, 1 August 2023 06:56 AM UTC
Ho John,

thx. Hope to find it

André
  1. Helpful
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Monday, 31 July 2023 08:48 AM UTC
  2. PowerBuilder
  3. # 2

Hi,

We've been using the "Modify(Create ...." on a dw that we have, but the problem part, using an external datawindow, was to add the columns to the 

table(column=(type=char(20000) updatewhereclause=yes name=special_cols dbname="special_cols" )
column=(type=char(250) updatewhereclause=no name=col1 dbname="col1" )
column=(type=char(250) updatewhereclause=no name=col2 dbname="col2" )
column=(type=char(250) updatewhereclause=no name=col3 dbname="col3" )
column=(type=char(250) updatewhereclause=no name=col4 dbname="col4" )
column=(type=char(250) updatewhereclause=no name=col5 dbname="col5" )
column=(type=c

part ... 

It would simply blow up, no matter what we tried.

So our solution that worked for us, was to pre-insert 250 type char(250) columns (not showing any initially), and then use the "Modify('Create... " syntax to place them on the datawindow.

regards.

Comment
  1. André Rust
  2. Monday, 31 July 2023 08:54 AM UTC
Hi Miguel,

thx for help

André
  1. Helpful
  1. Miguel Leeuwe
  2. Monday, 31 July 2023 08:59 AM UTC
yw

  1. Helpful
  1. Chris Pollach @Appeon
  2. Monday, 31 July 2023 13:08 PM UTC
Hi Miguel:

That's another good idea. Create a maximum column DW (all column combinations that you might need), then use the following command to remove the excess at runtime:

DC.Modify(“DESTROY ....”)

Regards.... Chris
  1. Helpful
There are no comments made yet.
André Rust Accepted Answer Pending Moderation
  1. Monday, 31 July 2023 06:24 AM UTC
  2. PowerBuilder
  3. # 3

Hi,

I will give it a try. I hope it is not too complicated.

Please send me more examples so I can get an overview. 

thx

André

Comment
There are no comments made yet.
mike S Accepted Answer Pending Moderation
  1. Saturday, 29 July 2023 11:41 AM UTC
  2. PowerBuilder
  3. # 4

elevate presentation:

https://www.youtube.com/watch?v=-5ZbrAJnmW0&list=PL2Eo5uXB4T3lvcLV_G9UMTxa1va0c33bk&index=5

Comment
  1. André Rust
  2. Monday, 31 July 2023 08:53 AM UTC
Hi Mike,

thx for help

André
  1. Helpful
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Friday, 28 July 2023 19:04 PM UTC
  2. PowerBuilder
  3. # 5

To build onto Chris's spot-on suggestion, keep in mind that the Grid presentation style is quite particular about the placement and spacing of column/text DWObjects. If you have not already done so, I highly recommend you edit the source of an existing Grid DataWindow data object and examine the X and Width property values in the lines that begin with "column(" and "text(". You'll see the pattern PB uses, and I suggest you mimic that pattern.

Best regards, John

Comment
  1. André Rust
  2. Monday, 31 July 2023 08:53 AM UTC
Hi John,

thxs for help

André
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Friday, 28 July 2023 17:45 PM UTC
  2. PowerBuilder
  3. # 6

Hi André

   Have you tried using the DW/DS control's Modify (Create Column .... ) command to Create a new column "on the fly"?

For example...

<DW Control Name>.Modify( &
"create  column( id=<an integer> tabsequence=<an integer> accelerator='<a single letter>' moveable=<0 - False, 1 - True> resizeable=<0 - False, 1 - True> pointer='<Arrow!, Cross!, HourGlass!, IBeam!, Icon!, Size!, SizeNESW!, SizeNS!, SizeNWSE!, SizeWE!, UpArrow!, or cursor filename (with path)>' band=<Detail, Footer, Header, Header.<group #>, Summary, Trailer.<group #>, Background, Foreground>"  +  &
" x='<an integer>' y='<an integer>' bitmapname=<Yes or No> criteria.dialog=<Yes or No> criteria.override_edit=<Yes or No> format='<constant string containing display format (i.e., [general]) for col (can also be an expression)>' alignment='<0 - Left, 1 - Right, 2 - Center>' criteria.required=<Yes or No> height.autosize=<Yes or No> border='<0 - None, 1- Shadow, 2 - Box, 3 - Resize, 4 - Underline, 5 - 3D Lowered, 6 - 3D Raised>' color='<a long>' height='<an integer>' width='<an integer>' name=<string> tag='<string>'"+&
" background.mode='<0 - Opaque, 1 - Transparent>' background.color='<a long>' font.face='<name of type face (i.e., SYSTEM, COURIER)>' font.height='<negative number for points, positive number for PBUs (i.e., -10 = 10 points, 10 = 10 PBUs>' font.weight='<400 - Normal, 700 - Bold>' font.family='<0 - AnyFont, 1 - Roman, 2 - Swiss, 3 - Modern, 4 - Script, 5 - Decorative>' font.pitch='<0 - default, 1 - Fixed, 2 - Variable>' font.charset='<0 - Ansi, 1 - default, 2 - Symbol, 128 - Shift JIS, 255 - OEM>' font.italic='<0 - False, 1 - True>' font.strikethrough='<0 - False, 1 - True>' font.underline='<0 - False, 1 - True>' html.link='<URL (with or without parameters) that is used to generate a link for each row of the particular column>' html.linktarget='<Target frame or window that is used to as part of the generated link for each row of the particular column>' html.linkargs='<argName>='<expr>' [<argName>='<expr>'] ...'"+&
"  edit.validatecode=<Yes or No> edit.focusrectangle=<Yes or No> edit.format=<constant string containing display format (i.e., [general]) for col (can also be an expression)> edit.nilisnull=<Yes or No> edit.password=<Yes or No> edit.required=<Yes or No> edit.hscrollbar=<Yes or No> edit.limit=<max number of chars the user can type (0 - 32767)> edit.codetable=<Yes or No> edit.displayonly=<Yes or No> edit.autovscroll=<Yes or No> edit.case=<Any, Upper or Lower> edit.autohscroll=<Yes or No> edit.autoselect=<Yes or No> edit.vscrollbar=<Yes or No> edit.name='<repository style name, if any>') ")

HTH

Regards ... Chris

Comment
  1. André Rust
  2. Monday, 31 July 2023 08:52 AM UTC
Hi Chris,

thxs for help

André
  1. Helpful
  1. Chris Pollach @Appeon
  2. Monday, 31 July 2023 13:09 PM UTC
You are most welcome! ;-)
  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.