>Procedure sqlVal(tcExpression, tcTable, tcWhere, toP1) > Local lnSelect > lnSelect = Select() > Local lcCmd, luVal > lcCmd = "Select " + m.tcExpression + " as val" > If not Empty(m.tcTable) > lcCmd = m.lcCmd + " from " + m.tcTable > If not Empty(m.tcWhere) > lcCmd = m.lcCmd + " WHERE " + m.tcWhere > EndIf > EndIf > If sqlDo(m.lcCmd,m.toP1,"sqlget") > luVal = sqlget.val > EndIf > Use in Select("sqlget") > Select (m.lnSelect) >Return m.luVal >>The call would be like this:
>? sqlVal("sum(qty*price)","JobItems") >>sqlDo is basically SqlExec, except that it gets the handle before.