1. Marco Meoni
  2. PowerBuilder
  3. Wednesday, 6 June 2018 20:06 PM UTC

Hi folks,

any idea on how to get column indices in a crosstab DW?

Say you have a crosstab showing products on the rows and delivery dates on the columns, with whatever values on the cells.

How would you set the cell backcolor to e.g. RED if sunday and WHITE if not? Or, to make it simpler, how to set RED only at cells with index 7, 14, 21....

Best,

Marco 

Markus Eckert Accepted Answer Pending Moderation
  1. Thursday, 7 June 2018 06:10 AM UTC
  2. PowerBuilder
  3. # 1

Hi Marco

For that specific example, I'd suggest you create a static crosstab (uncheck "Rebuild columns at runtime" when creating the DW)

You'll end up with a DW with 7 columns which you can then individually modify.

Unfortunately I have no idea how you can do it with a dynamic crosstab.

Regards,
Markus

Comment
  1. Marco Meoni
  2. Thursday, 7 June 2018 12:02 PM UTC
Hi Markus,

columns are not limited to 7, as they are automatically exploded by the crosstab between two date arguments, startdate and enddate.

Best,

.m

  1. Helpful
  1. Markus Eckert
  2. Friday, 8 June 2018 08:46 AM UTC
So your DW will have x columns, where x is the number of days between startdate and enddate?



One option I've found would be to programatically switch your DW between static and dynamic mode.



before retrieval: dw.modify('datawindow.crosstab.staticmode=no')

after retrieval: dw.modify('datawindow.crosstab.staticmode=yes')



Once you've switched it to static, you can get a list of your controls ( dw.describe ('datawindow.objects') ) and format them accordingly. You should be able to get the respective dates from the column headers.

  1. Helpful
There are no comments made yet.
David Peace (Powersoft) Accepted Answer Pending Moderation
  1. Thursday, 7 June 2018 14:02 PM UTC
  2. PowerBuilder
  3. # 2

HI Marcus

Personally I would not use a crosstab DW. I would either use a N column DW or generate my own columns across the DW to suit and then you have full control.

Either way its never that nice to code but at least you will be sure that it will work.

In my experience crosstabs (in any language) tend to fall like a deck of cards when you touch them so maintenance is a pain afterward.

Sorry that it's not a lot of help nor does it answer you question, but hopefully it will save you time thinking about using a crosstab.

All the best

David

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.