I'm using PB803-9704. I want to Create Group on DataWindow at runtime just
as we are doing for sorting & filtering using SetSort(), Sort() &
SetFilter(), Filter. Is there any possibility as I need this functionality
in so many reports.
Regards,
Taufiq Ahmed
Ken Drendel
On 10 Apr 2004 00:25:07 -0800,
in sybase.public.powerbuilder.datawindow
http://eric.aling.tripod.com/PB/tips/pbtip07.htm
Regards,
John
Team Sybase
"Taufiq Ahmed" <taufi...@autosoftdynamics.com> wrote in message
news:4077a153@forums-1-dub...
//-------------------------------------------------------------------------/
/
DataStore lds_temporary_storage
Long ll_syntax_len, ll_index, ll_target_object_len, ll_open_parenthesis,
ll_i
String ls_band, ls_syntax_before, ls_syntax_after, ls_syntax_new, ls_syntax,
ls_target_object
String ls_test, ls_this_character, ls_msg
IF UpperBound( is_object_name ) = 1 THEN
ls_band = This.Describe( is_object_name[ 1 ] + ".Band" )
IF Lower( ls_band ) = "detail" THEN
If IsValid (inv_expression) Then
ls_syntax = This.Object.DataWindow.Syntax
ll_syntax_len = Len( ls_syntax )
ll_index = 1
ls_target_object = "table"
ll_target_object_len = Len( ls_target_object )
ll_open_parenthesis = Pos( ls_syntax, ls_target_object + "(" ) +
ll_target_object_len
ls_test = Mid( ls_syntax, ll_open_parenthesis, 1 )
ll_index = 1
DO UNTIL ll_index = 0 OR ll_open_parenthesis = ll_syntax_len
ll_open_parenthesis++
ls_this_character = Mid( ls_syntax, ll_open_parenthesis, 1 )
IF ls_this_character = "(" THEN
ll_index ++
END IF
IF ls_this_character = ")" THEN
ll_index --
END IF
LOOP
IF ll_open_parenthesis < ll_syntax_len THEN
lds_temporary_storage = CREATE DataStore
lds_temporary_storage.Create( ls_syntax )
This.RowsCopy( 1, This.RowCount(), Primary!, lds_temporary_storage, 1,
Primary! )
// Put the Group information here.
ls_syntax_before = Left( ls_syntax, ll_open_parenthesis )
ls_syntax_after = Right( ls_syntax, ll_syntax_len -
ll_open_parenthesis )
ls_syntax_new = ls_syntax_before + '~r~ngroup(level=1 header.height=0
trailer.height=0 by=("' + is_object_name[ 1 ] + '" ) newpage=no
resetpagecount=no header.color="536870912" trailer.color="536870912" )' +
ls_syntax_after
This.Create( ls_syntax_new )
This.of_settransobject( sqlca )
lds_temporary_storage.RowsCopy( 1, lds_temporary_storage.RowCount(),
Primary!, This, 1, Primary! )
DESTROY lds_temporary_storage
This.Event ue_add_field_in_trailer()
ELSE
END IF
end if
ELSE
MessageBox( "Information", "Only columns in the main (detail) area can be
used when grouping. Please select a single column and try again." )
END IF
ELSE
ls_msg = ''
FOR ll_i = 1 TO UpperBound( is_object_name )
ls_msg += is_object_name[ ll_i ] + "~r~n"
NEXT
MessageBox( "Information", "Please make sure only one column is selected,
then try again.~r~nObjects selected:~r~n" + ls_msg )
END IF
//-------------------------------------------------------------------------/
/
is_object_name[] is an array of selected columns. ue_add_field_in_trailer()
pops up a window to add a computed column in the group trailer. You can
drop the inv_expression IF/THEN.
The basic concept is to cache the data, physically insert the group
information into the original DW syntax, recreate the DW, and reload the
data.
Ken Judkins
"Taufiq Ahmed" <taufi...@autosoftdynamics.com> wrote in message
news:4077a153@forums-1-dub...
Ken Drendel
On 13 Apr 2004 06:17:19 -0800,
in sybase.public.powerbuilder.datawindow
Ken Drendel
On 13 Apr 2004 06:17:19 -0800,
in sybase.public.powerbuilder.datawindow
Ken Judkins <nos...@notime.not> wrote: