Use selectdb to replace lookup/sql count(*)
Author: firstname.lastname@example.org (voltagecontrol)
I'm writing a $hits replacement in Uniface 8.4 (I'm sure all of you have done this at one point...) and have opted to use selectdb since lookup refuses to accept an entity parameter (oh, god, why?!).
However I can't seem to figure out the correct syntax for the selectfb function count(). I was under the impression that it'd be possible to write something similar to normal SQL, like this:
string v_table : in
string v_field : in
selectdb count(v_field) from v_table to v_hits
I though this code would make it possible to specify a specific field, and also that it'd be possible to replace v_field with an asterisk (*) to get a regular:
selectdb count(*) from v_table to v_hits
However, I keep getting compiler-errors whenever I don't supply a litteral fieldname for count(). Am I missing something fundamental here? The ulibrary pages for selectdb do say that I need to enter a LitFieldName, but having to hardcode the fieldname makes no sence, since it makes it quite hard to write dynamic code. How have you solved this?
Christoffer A, Sweden