1. Pierre Lecruit
  2. PowerBuilder
  3. Tuesday, 1 October 2024 15:20 PM UTC

Hello,

I am currently trying to implement a functionality that would let me dynamically change (for example delete) the columns in an export file (to MS Excel for example). These columns are as of right now loaded from a datastore. The datastore has all possible columns i could need in it, about 500. I am trying to make it possible to remove some of them, or change their name or order in the export file. I have already managed to gain access to the columns one by one to remove the data they should contain in the export file, but the name of the column is still there. I would like to be able to change that. I have already tried the modify("destroy column ...) but to no avail.

Thank you in advance for your response! 

John Fauss Accepted Answer Pending Moderation
  1. Tuesday, 1 October 2024 16:40 PM UTC
  2. PowerBuilder
  3. # 1

Hi, Pierre -

The problem is the "save as" function operates on the contents of the DataWindow's primary buffer, not on the various column DWObjects which may or may not have been created in the DataWindow Painter. The reason why the "Modify(destroy column..." approach does not accomplish what you are wanting to do is because Destroy column affects only the DWObjects...not the column definitions in the primary buffer. As far as I know, there is no way to remove columns from the primary buffer at execution time.

The only way I know this might possibly be done would be to dynamically create from syntax an external source DataWindow that contains all of the column definitions you want, in the order you want them, with the headings you want, and use that in a DataStore. Then you would have to copy the data from your "source" DW/DS into the "save as" DS, either cell by cell or perhaps one column at a time using dot notation. The datatypes on the column definitions would have to match for this to work. Note that this would essentially duplicate the amount of data kept in memory - which could have implications for very large datasets.

Best regards, John

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 1 October 2024 16:25 PM UTC
  2. PowerBuilder
  3. # 2

Hi Pierre;

  Have you tried ...

<DC/DS>.Modify( "destroy <Columnname>")

Regards .. Chris

Comment
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.