Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
UDF and FP Function, partiality
Message
General information
Forum:
Visual FoxPro
Category:
FoxPro 2.x
Miscellaneous
Thread ID:
00677396
Message ID:
00678398
Views:
19
This message has been marked as the solution to the initial question of the thread.
Foxpro 2.x doesn't allow UDF's in the SET FILTER condition. You'll have to build filter condition that uses Foxpro functions.
* FUNCTION FltTypGrp - builds filter condition
PARAMETERS m.typegroup, m.val1, m.val2, ..., m.val10
PRIVATE m.cntr, m.typgrpFlt
m.typgrpFlt = ""
FOR m.cntr=2 TO PCOUNT()
  m.typgrpFlt = m.typgrpFlt + [ OR "] + ;
  	EVALUATE("m.val" + TRANSFORM(m.cntr-1)) + [" $ ] + m.typegroup
ENDFOR
RETURN SUBSTR(m.typgrpFlt	, 5)
...
m.typefilt = flttypgrp("a09macct.typegroup", "CASH", "BANK")
...
>That is where the partiality comes in.
>
>
>>>>m.typefilt = "INLIST(a09macct.typegroup, 'CASH', 'BANK')"
>and my old way of parameter passing works
>
>Change typefilt to:
>
>>>>m.typefilt = "typgrp(a09macct.typegroup, 'CASH', 'BANK')"
>and FPD25 generates an error on the SET FILTER TO &zfilter. line in my INVHLP function:
>
>Error: 31
>Message: Invalid Subscript Reference
>
>Even for the following simple function:
>
>
Function typgrp
>parameters m.z1, m.z2, m.z3
>return inlist(m.z1, m.z2, m.z3)
>
>the para m.zfilter with the value "typgrp(a09macct.typegroup, 'CASH', 'BANK')" is now, I guess, interpreted as an array, where as when the m.zfilter was "INLIST(a09macct.typegroup, 'CASH', 'BANK')" FP knew it was a function. So if I send &typefilt. then the current value is interpreted and sent to invhelp() and invhelp won't like it at the IF line before SET FILTER. Plus the value passed is for the current record only and the utiliy won't remain.
>
>How can I tell FP typgrp is a function and not an array. I can't do this in the invhelp() function as it is a common usage thing and I don't know if there will be any filters required or not and if so am I using UDF or FP functions.
>
>
< snip >
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform