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:
00679478
Views:
30
Thanks Sergey I have implemented all the three suggesstion and frankly I thought square bracket string delim was for Windows.

>You can save a few characters if you pass field name w/o alias
m.typefilt = flttypgrp("typegroup", "CASH", "BANK")
Also you don;t need spaces around '$' operator.
m.typgrpFlt = m.typgrpFlt + [ OR "] + ;
>  	EVALUATE([m.val] + ALLTRIM(STR(m.cntr-1))) + ["$] + m.typegroup
BTW, using square brackets as string delimiters when you build expessions dynamicaly make code more readeable and allow to use single and double quotes inside strings.
>
>
>>Thank you the function worked with a tweak
>>> m.typgrpFlt = m.typgrpFlt + ' OR "' + ;
>>> EVALUATE("m.val" + ALLTRIM(STR(m.cntr-1))) + '" $ ' + m.typegroup
>>
>>Now I have run up against 255 line length limit when I club the new filter with the required basic filters <g>
>>
>>>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 >
Regards
Bhavbhuti
___________________________________________
Softwares for Indian Businesses at:
http://venussoftop.tripod.com
___________________________________________
venussoftop@gmail.com
___________________________________________
Previous
Reply
Map
View

Click here to load this message in the networking platform