gINTRules.GridData.DataArray not returning all rows for 1-1 relationship child table

Hello,

I am trying to change the colour of rows of a table called (GOSA) based on a boolean field (GEOL_ISRK)  from another table (GEOL).

The GOSA table has a one to one relation with the GEOL table, and has Show All Parent Keys set to true.

Thus when I got into the GOSA table for the first time (after filling in all the depth for the GEOL table) it will display all these entered depths.

The problem is that on the first entry of the GOSA table:
glNumRows=UBound(gINTRules.GridData.DataArray, 2)
only returns 1 (and not all the rows as determined by the number of rows in GEOL)

Interestingling if there are say 10 rows in GEOL, and I have 1 entry in row 8 of GOSA, glNumRows returns 8.

The solution I have is to redim the GOSA table, add in the GEOL depth keys and then colour the desired rows . i.e.:

  sSql = "Select Count(*) As Total " & _
      "From [" & s_Table_GEOL & "] " & _
      "Where [" & gs_PointID & "] = '" & gINTRules.GridData.ParentRecord(gs_PointID) & "'"

  Set rsTemp = gINTRules.CurrentProject.OpenRecordset(sSql, dbOpenSnapshot)
  If Not rsTemp.EOF Then
    lNumberOfGEOLRows = rsTemp("Total")
  End If
  RecordsetClose rsTemp


  ReDim gsDataA(0 To UBound(gsDataA,1), 1 To lNumberOfGEOLRows)

But is there a better way?

Many thanks.

Calan.

 

  • Hi Calan

    By checking show all parent keys, it isn't creating real database records.  So doing a SQL count is not going to give the answer you want, unless you have really created the records.

    I also tested what UBound(gINTRules.GridData.DataArray, 2) returns, and in my test it returned the row number for the last row that actually exists.  If no records actually exist, then UBound(gINTRules.GridData.DataArray, 2)  = 0.

    If you want the records to exist, be it with only the key fields, then you could run an INSERT SQL that populates the key fields upon on save for GEOL when records are first created in GEOL.

    You will know the record is new OnSave when the GintRecID = 0.  BTW, if a record has changed the GintRecID is negative.

    Then you can then run code On Updating Grid for the GOSA to set the cell colour.

    Feel free to give me a call.

    Phil Wade
    Datgel
    Bentley Channel Partner and Developer Partner
    E: phil.wade@datgel.com | T: +61 2 8202 8600 & +65 6631 9780

    Get the most out of gINT with Datgel Tools.