1. Sivaprakash BKR
  2. PowerBuilder
  3. Tuesday, 28 June 2022 06:42 AM UTC

Hello,

PB 2019 R3
What's the order of objects (columns) fetched while executing dw_1.Describe("Datawindow.Objects") ?

We have a generic routine that reads and displays all columns in a datawindow by executing the describe command.   That lists all columns, but not in the order that we expect.  One of our Customers wants it to list columns in a particular order.   

The order of objects is not in the Select <column> order, not listed as in Column Specifications order.   Would like to know in which order the command lists the columns order ?

1.  Is there any way to change the list order of columns?
2.  Or any other way that I can read all columns list in a datawindow?

Happiness Always
BKR Sivaprakash

 

Roland Smith Accepted Answer Pending Moderation
  1. Tuesday, 28 June 2022 17:47 PM UTC
  2. PowerBuilder
  3. # 1

They aren't in a particular order, it might be the order they appear in the object source.

 

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 28 June 2022 17:11 PM UTC
  2. PowerBuilder
  3. # 2

Hi Sivaprakash;

   FWIW: My STD Framework processes DWO columns by extracting all the names via a Describe() command and then importing these into an External DW where it can slice & dice (filter / sort) all the object names by name, type, etc. Then process the DW's objects from the names in the External DWO's buffer when ready. I would highly recommend this approach for maximum flexibility & ease of processing. Food for thought.

Regards ... Chris

Comment
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Tuesday, 28 June 2022 13:47 PM UTC
  2. PowerBuilder
  3. # 3

I agree with Rene that if you want/need a specific ordering, you need to implement it yourself.

Maybe use a keyword/value string in each column object's Tag property that your code can look for and utilize, such as "ListOrder=nn".

 

Comment
  1. Sivaprakash BKR
  2. Wednesday, 29 June 2022 13:44 PM UTC
Thanks John Fauss,

We thought of implementing the 'tag property' approach by inserting the required value as a JSON string. The idea (column.count) given by Rene Ullrich seems working to our expectation. Will do a thorough test of that and if that doesn't workout, we will be switching to this approach.

  1. Helpful
There are no comments made yet.
René Ullrich Accepted Answer Pending Moderation
  1. Tuesday, 28 June 2022 07:00 AM UTC
  2. PowerBuilder
  3. # 4

I guess objects are listet in the order of appearance in the datawindow source (FrontToBack order).

 

Do you need the column objects in the datawindow or do you need the columns in the column specifications?

For columns in column specification the best way is to loop from 1 to column.count to get the name by id ("#"+string(li_i)+".Name").

 

If you need a specific order I think you have to implement it yourself. The order of objects in source may change if you do some editings in the datawindow painter.

Comment
  1. Sivaprakash BKR
  2. Wednesday, 29 June 2022 13:41 PM UTC
Thanks Rene Ullrich,

With column.count loop, it worked to our expectation in our initial test. The best thing is that we could control the order of the columns in our select statement.

Hope it will solve this issue.
  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.