Subject Re: DataModule and Distinct
From edward racht <e.racht@gmail.com>
Date Mon, 17 Sep 2018 12:12:26 -0400
Newsgroups dbase.getting-started

Greetings,

I have worked the datamodule and realized that the canGetRow is not providing unique ORP = 'O' values.  I have another value in there - 'R' that keeps coming through.

The dmd code follows:

   with (this.PNOGORP1)
      database = form.palt1
      sql = 'Select * from "ld"'
      active = true
   endwith

   with (this.PNOGORP1.rowset)
      canGetRow = {||empty( this.fields[ "OW" ].value ) AND ;
             not empty( this.fields[ "ORP" ].value ) == upper( "O" )}

Following is the form code

   FUNCTION CBOG_onOpen
      local r, q
      // Define the Array  
      aSource = new Array()
      r = form.LDRPTDATAMODULE1.pnogorp1.rowset.fields[ "orp" ]

      q = form.LDRPTDATAMODULE1.pnogorp1.requery()
      q = form.LDRPTDATAMODULE1.pnogorp1.sql = "select distinct ORP = 'O' from
                                                         pnog1 where ORP is not null and OPR <> '' "

       this.datasource = form.ldrptdatamodule1.pnogorp1.rowset.fields["orp"]

/*
         if form.CNRPT1.CBOG1.LDRPTDATAMODULE1.pnogorp1.rowset = 0
            this.Value = 'No Data To Print'
            form.CNRPT1.PBRPTI1.enabled = false  // Not available
         else
         form.CNRPT1.PBRPTI1.enabled = true
         endif
*/

RETURN

ed