| Subject |
Re: can I use a CDM the same way as I use a DMD? |
| From |
Gaetano <gaetanodd@hotmail.com> |
| Date |
Mon, 28 Sep 2020 06:30:30 +1000 |
| Newsgroups |
dbase.getting-started |
Hi Akshat,
Here it is:
** END HEADER -- do not remove this line
class BaseSO2devCDATAMODULE of DATAMODULE custom
this.SO2ADO1 = new ADODATABASE(this)
with (this.SO2ADO1)
left = 19.0
top = 135.0
connectionstring = "myconnectionstring"
active = true
endwith
//making the ADO fix available to downstream routines
set procedure to ADOapachefix.cc additive
//making this function available to add calculated fields
function calcField(cName,nLength)
local oField
oField = new field()
ofield.fieldname := cName
oField.length := nLength
this.rowset.fields.add(oField)
return
endclass
Then in the DMD - you'll recognize the SQL statement ;) :
** END HEADER -- do not remove this line
//
// Generated on 17/09/2020
//
class SO2devMissEntriesDATAMODULE of BASESO2DEVCDATAMODULE from
"BaseSO2dev.cdm"
with (this.SO2ADO1)
left = 26.0
top = 43.0
width = 115.0
height = 112.0
endwith
this.ENERGYDATA1 = new ADOQUERY(this)
with (this.ENERGYDATA1)
left = 162.0
top = 60.0
width = 115.0
height = 146.0
database = form.so2ado1
connected = true
sql = "SELECT test_site.siteNum,all_timestamps.etimestamp FROM
test_site,all_timestamps "+;
"WHERE concat(test_site.siteNum,' ',all_timestamps.etimestamp) "+;
"NOT IN (SELECT CONCAT(siteNum,' ', etimestamp) FROM
energydata_temp) "+;
"AND all_timestamps.etimestamp BETWEEN :dStart and :dEnd"
params["dStart"].value = "2020-06-04 16:40"
params["dEnd"].value = "2020-06-30 17:00"
active = true
endwith
this.rowset = this.energydata1.rowset
endclass
Cheers,
Gaetano.
On 27/09/2020 19:19, Akshat Kapoor wrote:
> On 26.09.2020 11:38, Gaetano wrote:
>>
>> It's for a web app, so no forms involved and most likely no reports
>> either (I export the outputs to CSV format for download), but from
>> your inputs, I take it that it is still advisable to use an existing
>> DMD that already inherits from that CDM, even if I only use the
>> database component of it for a particular routine.
>>
>> Thanks for your inputs Ken!
>
> Good Afternoon Gaetano,
> Can you share the custom datamodule and a datamodule built on it.
>
> Please replace password / server name / with XXXXXX
> The sql in datamodule can just be "select * from table1"
>
> I tried but failed in designing a custom datamodule.
>
> This is one aspect which I have not considered for how to change
> database details at one place and make the change effective throughout
> the app.
>
> I would like to take a look.
> Regards
> Akshat
|
|