* Problem getting value of "Where Within Source"

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
avatar
shoshk
Famous
Posts: 242
Joined: 13 May 2015 16:28
Family Historian: V7
Location: Mitzpe Jericho, Israel

Problem getting value of "Where Within Source"

Post by shoshk » 08 Jun 2015 04:34

Hi all,

In my plugin, I have the following code:

local strCit = fhGetValueAsText(fhGetItemPtr(ptrCitation, '~.AUTH'))
local strTitle = fhGetValueAsText(fhGetItemPtr(ptrCitation,'~.TITL'))
local strPubl = fhGetValueAsText(fhGetItemPtr(ptrCitation,'~.PUBL'))
local strPage = fhGetValueAsText(fhGetItemPtr(ptrCitation,'~.PAGE'))

All works as expected, except for the last line, which always returns an empty string, even though there is text in "Where Within Source."

Your help is appreciated.

Shoshana
Shosh Kalson

avatar
shoshk
Famous
Posts: 242
Joined: 13 May 2015 16:28
Family Historian: V7
Location: Mitzpe Jericho, Israel

Re: Problem getting value of "Where Within Source"

Post by shoshk » 08 Jun 2015 05:02

Hi again,

OK. So I figured it out and thought I'd post the solution in case it helps somebody else.

Those pesky greater-than signs...

I initialized ptrCitation as follows (I'm looping through citations, so I use a variable for the index):

local cit = 1
local ptrCitation = fhGetItemPtr(pFact, '~.SOUR[' .. cit .. ']>')

But, to get at "Where Within Source", as opposed to the Author, Title and Publication Facts, you don't use ">"

So I changed my code to:

local ptrPage = fhGetItemPtr(pFact, '~.SOUR[' .. cit .. '].PAGE')
local strPage = fhGetValueAsText(ptrPage)

And now it works.

Shoshana
Shosh Kalson

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

Re: Problem getting value of "Where Within Source"

Post by tatewise » 08 Jun 2015 11:11

Just to clarify, the Citation & Source details are in different positions with different data refs.

Citations are attached to Facts in the Individual/Family Records, i.e. they appear in the Individual/Family Property Box and separated with a dot.
~.SOUR[1].DATA.DATE = 1st Citation Entry Date
~.SOUR[1].DATA.TEXT[1] = 1st Citation 1st Text From Source
~.SOUR[1].PAGE = 1st Citation Where within Source
~.SOUR[1].NOTE2[1] = 1st Citation 1st Note

Sources are separate Records and appear in a Source Property Box, which is why you need the > link indicator.
~.SOUR[1]>AUTH = 1st Source Record Author
~.SOUR[1]>TEXT =1st Source Record Text From Source
~.SOUR[1]>NOTE2[1] = 1st Source Record 1st Note
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

Post Reply