Bug 4981

Modifying Datawindow column by # changes wrong column if two have the same name 29 September, 2020

Matthew Caffrey
24 July, 2020
Product: PowerBuilder Category: PowerScript
Version: 2019 R2 Build: 2328
Classification: Publishing: Public
Priority: P3
Status: Verifying Reason:
armando herrera @Appeon 29 September, 2020
#9
Hi Matthew, 


I would like to check with you if the response provided has been helpful enough to resolve your case. If so, can we proceed to close the ticket?.


Otherwise, do let us know if we can provide you with any further assistance and keep in mind that you are always welcome to open another ticket in case you need it.


Regards!
armando herrera @Appeon 15 September, 2020
#8
Hi Matthew,

Are you still facing this matter? 
Is there anything else we can do to keep helping?.

Regards!
armando herrera @Appeon 03 September, 2020
#7
Hi Matthew,

Are you still facing this matter? 

This ticket has been stopped due to a required test case and we need to collect more information about it, please note you can also send us a Set of screenshots or a small video showing the case so that we can try to collect the information we require to move on.

Thanks for your understanding!
Ken Guo @Appeon 21 August, 2020
#6
Hi Matthew,

If the same column listed twice in the Select Clause of the SQL, e.g. 
>select name_a, name_b, name_a from test
then after SyntaxFromSQL is executed, generally speaking, the syntax it generated will include name_a, name_b, name_a_1, not the same name column.

If the above SQL can generate the same name column on your side, please provide a test case for us for more study. 


Regards,
Ken
Matthew Caffrey 20 August, 2020
#5
(In reply to armando herrera  @Appeon from comment #4)
Hi Matthew, 

I would like to check with you if the response provided has been was helpful
enough to resolve your case. If so, can we proceed to close the ticket?.

Otherwise, do let us know if we can provide you with any further assistance
and keep in mind that you are always welcome to open another ticket in case
you need it.

Regards!
We followed Ken's instructions and made changes to not have the same column name repeated twice in a datawindow. It should be noted that while the DataWindow painter does not allow duplicate columns like this, it is easy to be in this situation when generating datawindows dynamically with SyntaxFromSQL, which is what we use in our system to dynamically generate screens. Since a SELECT clause in a SQL statement can have the same column listed twice, the datawindow generated from SyntaxFromSQL would have the same column twice.
armando herrera @Appeon 20 August, 2020
#4
Hi Matthew, 

I would like to check with you if the response provided has been was helpful enough to resolve your case. If so, can we proceed to close the ticket?.

Otherwise, do let us know if we can provide you with any further assistance and keep in mind that you are always welcome to open another ticket in case you need it.

Regards!
Ken Guo @Appeon 29 July, 2020
#3
Hi Matthew,

There are two columns with the same name ‘column_a’ in your DataWindow, it is not recommended. 
When you add two columns with the same name to the PB IDE DataWindow Painter, it will show you that ‘Item 'column_a' does not pass the validation test’.

There will be some optimizations to the inner code logic in subsequent PB versions. So if there is the same column name in one DW, it will cause some exceptions.
Thus, I suggest you modify one of the column names to a different one.

Regards,
Ken
Chris Pollach @Appeon 24 July, 2020
#2
Hi Matthew;

  Thank you so much for the Test Case!

  I was able to reproduce this issue in PB 2019 R2 build 2328.

  I was *not* able to reproduce this issue in PB 2017R3 build 1915 or PB 12.6 - the Modify() worked as you stated in PB 10.5.

  I will now transfer this ticket over to the main Support / Engineering team for their review and feedback on a fix for this issue.

Regards ... Chris
Matthew Caffrey 24 July, 2020
#1
column_num_bug.pbl (56KB)

*Phenomenon: If you have a datawindow with 2 columns with the exact same name, and you try to modify an attribute of the second column using column number notation (for instance, DW_NAME.MODIFY('#5.VISIBLE=0'), the first column will be modified.  In older versions of PowerBuilder (I tested in PB10.2), this used to work properly, and the specified column # was properly modified.


*Reproduce Steps: I have a PBL attached with a simple test case for exactly this procedure (no DB needed).  They key is to have a datawindow with the same column name list twice.  The typical flow for this would be using SYNTAXFROMSQL, but I used a simple external data source DW in this example.

1) Create datawindow with two columns with the exact same name.
2) Modify an attribute of the second column, specifying by column #.
3) The first column is modified.

In the example attached, I have an external datasource DW like this:
table(column=(type=char(10) name=column_a dbname="column_a" initial="Data1" )
 column=(type=char(10) name=column_b dbname="column_b" initial="Data2" )
 column=(type=char(10) name=column_a dbname="column_a" initial="Data3" ) )
column(band=detail id=1  name=column_a visible="1")
column(band=detail id=2  name=column_b visible="1")
column(band=detail id=3  name=column_a visible="1")

When you click the button it calls this code:
dw_column_num_bug.Modify('#3.Visible=0')

Column #1 is modified instead of Column #3.

The same test in PB10 modifies Column #3.



Remarks:
OS:
Windows 10
Platform:
All
Database Type:
Oracle
Database Version: