This my scope : set filter to &(cfilter)
- Code: Select all Expand view RUN
a_fields[1]:="4->me_mc_serl"
a_fields[2]:="4->me_mc_brn"
a_vars[1]:=V_me_SERIAL
a_vars[2]:=V_mc_brn
cValue := ""
cFilter := ""
For i := 1 to 2
IF Empty(a_Vars[i]) && Don't process empty variables
LOOP
ENDIF
DO CASE && Create char value
CASE (VALTYPE(a_vars[i]) == "D" .and. a_vars[i]==V_me_START_D);
.or. (VALTYPE(a_vars[i]) == "D" .and. a_vars[i]==V_me_in_d)
cValue := 'DTOS(' + a_Fields[i] + ') == "' + DTOS(a_Vars[i]) + '"'
CASE VALTYPE(a_vars[i]) == "D" .AND. i==5
cValue := 'DTOS(' + a_Fields[i] + ') >= "' + DTOS(a_Vars[i]) + '"'
CASE VALTYPE(a_vars[i]) == "D" .AND. i==6
cValue := 'DTOS(' + a_Fields[i] + ') <= "' + DTOS(a_Vars[i]) + '"'
CASE VALTYPE(a_vars[i]) == "N"
cValue := 'STR(' + a_Fields[i] + ') == "' + STR(a_vars[i]) + '"' && or
* some other NUM->Chr conversion
CASE VALTYPE(a_vars[i]) == "C"
cValue :="alltrim(upper("+ a_Fields[i]+"))" + '=="' + alltrim(upper(a_Vars[i])) + '"'
ENDCASE
IF Empty(cFilter) && this is the first element
cFilter := cValue
ELSE
cFilter += " .AND. " + cValue
ENDIF
NEXT
set filter to &(cfilter)