Setting a query parameter  


New Member
Joined: 1 month  ago
Posts: 1
8 August 2017 17:18  

Greetings. I attended the ColumbusEgg4Delphi webinar and was impressed. I'm starting to look at incorporating it into my applications and I have a newbie question: how would I incorporate setting a query parameter into the ColumbusModule attached to a dataset?

Example: suppose I want to count the records (or derive some other aggregate function) satisfying a particular condition (similar to the CalcCaliforniaPersons example given in the ColumbusPrimer example) but I don't want to just loop through the dataset one record at a time -- there may be many many records. Ordinarily I would build a query like SELECT COUNT(*) FROM MyDataSet WHERE ConditionValue = :Value; and then set ParamByName('Value').Value as desired. But ColumbusModule doesn't know whether my DataSet is a query and so has no way of setting a parameter value.

I could typecast the DataSet in my ColumbusModule as a query type, but that would mean goodbye to loose coupling. It looks to me like my best approach may be to define a procedure in the ColumbusModule -- call it SetConditionValue -- and link it to a procedure in my data module or form that operates on the query. Am I on the right track? Or should I be triggering this through a Listener? 

Daniele Teti
Eminent Member
Joined: 6 months  ago
Posts: 42
4 September 2017 22:54  

Sorry for the delay. Did you solve the problem?



Daniele Teti
CEO & CTO @ bit Time Professionals
Embarcadero MVP
Books Author


Please Login or Register