1. Jan Kopal
  2. PowerBuilder
  3. Wednesday, 4 December 2019 15:18 PM UTC

Hi,

is it possible to conditionally format headers in crosstab (dynamic)?

We have a crosstab, in rows there are accomodation units, in columns there are days. In value is the information, if that unit is empty or occupied. 

In the header is number of week and another information (e.g. name of action in this week), we need to have some background color when this value is empty and another color when this value is filled.

But this header value title is @action_name, it can't be used in expression. Gettext() does not work, it's only for columns (this is text).

We need something like this:

if(IsNull(@action_name), rgb(255,0,0), rgb(0,255,0)) - but it does not work...

crosstab

Anybody can help?

Thank You... Jan

(Appeon Powerbuilder 2017R3)

Accepted Answer
Jan Kopal Accepted Answer Pending Moderation
  1. Thursday, 12 December 2019 09:04 AM UTC
  2. PowerBuilder
  3. # Permalink

Thank you for your response.

I don't know the maximum number of columns. User selects the beginning and the end of the stay, crosstab is displayed according to the number of days.

Finally I solved it like this - after datawindow retrieve the following code is executed:

// switch crosstab to static mode
this.modify("DataWindow.Crosstab.StaticMode=yes")
// find objects in crosstab
ls_objects = this.describe( "datawindow.objects")
// parse string to array
lnv_string.of_parsetoarray( ls_objects, "~t", ls_obj_array)

// go throuhgh all objects
for ll_i = 1 to UpperBound(ls_obj_array)
// object has at the beginning of name "t_nazev_akce" --- t_nazev_akce_1, t_nazev_akce_2, ...
if left(ls_obj_array[ll_i],12) = "t_nazev_akce" then
// do something... e.g. change color by name...
this.modify(ls_obj_array[ll_i] + ".background.color=" + string(ll_barva_akci)+"")
end if
next

// switch back to dynamic mode
this.modify("DataWindow.Crosstab.StaticMode=no")

 

Maybe it will help someone else.

 

Jan

Comment
  1. Michael Kramer
  2. Thursday, 12 December 2019 14:20 PM UTC
Hi Jan, Thank you for sharing! Important for future readers searching for help.
  1. Helpful
  1. Sivaprakash BKR
  2. Sunday, 15 December 2019 02:39 AM UTC
Good share. Thanks Jan.
  1. Helpful
There are no comments made yet.
René Ullrich Accepted Answer Pending Moderation
  1. Thursday, 5 December 2019 07:10 AM UTC
  2. PowerBuilder
  3. # 1

Hi Jan,

I don't know a way to do this with Crosstabs.

If you know the maximum number of columns (e.g. you always show a week or a month) you may use a tabular or grid datawindow. You may hide additional columns if you don't need it (e.g. day 31).

You may also create such a datawindow at runtime if you don't know the maximum number of columns.

HTH,

René

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.