* TextPart fails via Plugin

For users to report plugin bugs and request plugin enhancements; and for authors to test new/new versions of plugins, and to discuss plugin development (in the Programming Technicalities sub-forum). If you want advice on choosing or using a plugin, please ask in General Usage or an appropriate sub-forum.
Post Reply
User avatar
tatewise
Megastar
Posts: 27080
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

TextPart fails via Plugin

Post by tatewise » 25 Jan 2015 17:51

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.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
SimonOrde
Program Designer
Posts: 352
Joined: 18 Nov 2002 10:20
Family Historian: V7
Location: Calico Pie

Re: TextPart fails via Plugin

Post by SimonOrde » 27 Jan 2015 12:30

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).

User avatar
tatewise
Megastar
Posts: 27080
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: TextPart fails via Plugin

Post by tatewise » 04 Feb 2015 15:20

This is confirmed as fixed in FH V6.0.2 except that 2nd param must be a text string not a ptr.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

Post Reply