Ultragrid bands...

Posted by saquib on 02-Dec-2010 08:18

Hi,

I have a program that uses an ultragrid to display a single temp-table within a data set.

        THIS-OBJECT:bindingSource2 =
            NEW Progress.Data.BindingSource(DATASET dsBO_ProductAvailability:HANDLE,
                                            "ttBO_ProductAvailability",           
                                            "*",

                                            "").

I have code that gets the number of rows within the grid and examines the value of a specific cell for each row and sets the row colour accordingly:

DO lvicount = 1 TO GridSpecialOffers:Rows:Count
  IF (GridSpecialOffers:rows:Item[lvicount - 1]:cells:item["isTagged"]:value:ToString()) = "True":U  THEN
 
  do something...
 
END.

This works fine, however, I've now changed my data-set such that I have two tables with a parent/child relationship:

DEFINE {&MODIFIER} DATASET dsBO_ProductAvailability
  FOR ttBO_ProductAvailability, ttBO_SpecialOffers
  DATA-RELATION FOR ttBO_ProductAvailability, ttBO_SpecialOffers RELATION-FIELDS(ProductAvailabilityKey, ParentKey) NESTED.
 
The original "special offer" temp table is now a "child" of a new temp-table "product availability" and is no longer BAND[0] but
BAND[1] within my data grid.

It's possible now to have many Special Offers for a given product and obviously the code above will fail as ["isTagged"] does not exist in
the parent table at row 'n'.

What I need to do is for each row of the parent table (BAND 0), get any child records (BAND 1 special offers) and examine each child row of the parent for the
["isTagged"] value and set the row colour accordingly.

Can anyone help?

Many Thanks,

Saquib.

All Replies

Posted by Admin on 02-Dec-2010 08:30

The original "special offer" temp table is now a "child" of a new temp-table "product availability" and is no longer BAND[0] but

BAND[1] within my data grid.

 

Should be possible using either the ParentRow (from the child to the parent) or the ChildBands collection (parent to child).

oParentRow:ChildBands[0]:Rows

Posted by saquib on 02-Dec-2010 10:07

Thanks,

It now works:

  DO lvicount = 1 TO GridSpecialOffers:Rows:Count:

      IF GridSpecialOffers:DisplayLayout:Rows:Item[lvicount - 1]:ChildBands[0]:Rows:count > 0 THEN
      DO:
        DO i = 1 TO GridSpecialOffers:DisplayLayout:Rows:Item[lvicount - 1]:ChildBands[0]:Rows:count:

           IF (GridSpecialOffers:DisplayLayout:Rows:Item[lvicount - 1]:ChildBands[0]:Rows:Item[i - 1]:cells:item["isTagged"]:value:ToString()) = "True":U  THEN
           DO:
              GridSpecialOffers:DisplayLayout:Rows:Item[lvicount - 1]:ChildBands[0]:Rows:Item[i - 1]:Appearance:BackColor = mycolour.

.....

Saquib.

This thread is closed