Page 1 of 1

TextPart fails via Plugin

Posted: 25 Jan 2015 17:51
by tatewise
The =TextPart() function fails when called via fhCallBuiltInFunction() in a Plugin.
e.g.
fhCallBuiltInFunction("TextPart","A,B,C",1,1,"STD")
gives the error message:
An error has occurred - plugin failed to complete
[string "C:\Users\Mike\AppData\Local\Temp\~fh9C67.tm..."]:1: fhCallBuiltInFunction - Parameter 5: unknown error
No changes have been made to data records.


Changing "STD" to "TIDY" or removing it makes no difference.

Secondly, parameter 2 must be a text string, and not a pointer to a text string.
The FH Help examples for =TextPart() use %INDI.BIRT.PLAC% which implies a data ref pointer should work.
e.g.
Anything like:
fhCallBuiltInFunction("TextPart",fhGetItemPtr(ptr,"~.ADDR"),1,1)
gives the error message:
An error has occurred - plugin failed to complete
[string "C:\Users\Mike\AppData\Local\Temp\~fhDC06.tm..."]:35: bad argument #2 to 'fhCallBuiltInFunction' (string expected, got userdata)
No changes have been made to data records.

Re: TextPart fails via Plugin

Posted: 27 Jan 2015 12:30
by SimonOrde
Thanks for report this Mike. It turns out that all functions which have a parameter which is an enumerated value, introduced in version 6, also don't work with fhCallBuiltInFunction. We will fix this (for all of them) in the next upgrade (due out soon).

Re: TextPart fails via Plugin

Posted: 04 Feb 2015 15:20
by tatewise
This is confirmed as fixed in FH V6.0.2 except that 2nd param must be a text string not a ptr.