Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

building filter including logical field

0 views
Skip to first unread message

happytoday

unread,
Jul 14, 2008, 3:20:51 AM7/14/08
to
I need to include a logical field inside that filter but I know how to
convert from char to logical : using if(field.,.T.,.F.)
but how can I include this in those statement :

a2_fields[1]:="mete->Me_CU_name"
a2_fields[2]:="mete->Me_CU_ACCt"
a2_fields[3]:="mete->Me_CT_CTNA"
a2_fields[4]:="mete->Me_mc_type"
a2_fields[5]:="mete->Me_mc_modl"
a2_fields[6]:="mete->Me_mc_serl"
a2_fields[7]:="mete->Me_mc_brn"
a2_fields[8]:="mete->Me_mc_mere"
a2_fields[9]:="mete->Me_mc_dep"
a2_fields[10]:="mete->Me_mc_loc"
a2_fields[11]:="mete->me_date"
a2_fields[12]:="mete->me_date"

a2_vars[1]:=oCombo1
a2_vars[2]:=oCombo2
a2_vars[3]:=oCombo3
a2_vars[4]:=oCombo4
a2_vars[5]:=oCombo5
a2_vars[6]:=oCombo6
a2_vars[7]:=oCombo7
a2_vars[8]:=oCombo8
a2_vars[9]:=oCombo9
a2_vars[10]:=oCombo10
a2_vars[11]:=v_strd
a2_vars[12]:=v_endd


For i := 1 to 12

IF Empty(a2_Vars[i]) && Don't process empty variables
LOOP
ENDIF

DO CASE && Create char value
CASE VALTYPE(a2_vars[i]) == "D" .AND. i==11
cValue:= 'DTOS(' + a2_Fields[i] + ') >= "' +
DTOS(a2_Vars[i]) + '"'
CASE VALTYPE(a2_vars[i]) == "D" .AND. i==12
cValue := 'DTOS(' + a2_Fields[i] + ') <= "' +
DTOS(a2_Vars[i]) + '"'
CASE VALTYPE(a2_vars[i]) == "N"
cValue := 'STR(' + a2_Fields[i] + ') == "' +
STR(a2_vars[i]) + '"' && or
CASE VALTYPE(a2_vars[i]) == "C"
cValue :="upper("+ a2_Fields[i]+")" + '=="' +
upper(a2_Vars[i]) + '"'
ENDCASE
IF Empty(cFilter) && this is the first element
cFilter := cValue
ELSE
cFilter += " .AND. " + cValue
ENDIF
NEXT

Stephen Quinn

unread,
Jul 14, 2008, 5:27:53 AM7/14/08
to
Ehab

Use the FOR clause of the filter, either that or you need to include the
logic field in your index.
Eg
cFilter := cValue
cFor := ' FOR FIELDNAME' // show inclusions
or
cFor := ' FOR ! FIELDNAME' // show exclusions
IF !empty( cFor )
cFilter += cFor
ENDIF

or
// Include in index as a character
INDEX ON Whatever + IIF( FIELDNAME, 'T', 'F' )

HTH
Steve


E. Fridman

unread,
Jul 14, 2008, 9:27:43 AM7/14/08
to
>>> I know how to convert from char to logical : using if(field.,.T.,.F.) <<<

Did you mean &field. ?

happytoday

unread,
Jul 15, 2008, 4:15:40 PM7/15/08
to
On Jul 14, 4:27 pm, "E. Fridman" <pm771...@gmail.com> wrote:
> >>> I know how to convert from char to logical : using if(field.,.T.,.F.) <<<
>
> Did you mean &field.  ?

Yes I need to build but valtype(logical field) == "C" Why ???
Can't I add a new statement inside the filter building indication for
logical field ?

AUGE_OHR

unread,
Jul 15, 2008, 4:33:38 PM7/15/08
to
hi,

>>> I know how to convert from char to logical : using if(field.,.T.,.F.)
>>> <<<
>>
>> Did you mean &field. ?

>Yes I need to build but valtype(logical field) == "C" Why ???
>Can't I add a new statement inside the filter building indication for
>logical field ?

"... .AND. myField"
.OR.
"... .AND. .NOT. myField"

greetings by OHR
Jimmy


Stephen Quinn

unread,
Jul 15, 2008, 6:47:36 PM7/15/08
to
Ehab

> Yes I need to build but valtype(logical field) == "C" Why ???

At a guess I'd say you used
VALTYPE('FIELDNAME')
instead of
VALTYPE(xx->FIELDNAME)

CYA
Steve


0 new messages