Page 1 of 1

Problem getting value of "Where Within Source"

Posted: 08 Jun 2015 04:34
by shoshk
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

Re: Problem getting value of "Where Within Source"

Posted: 08 Jun 2015 05:02
by shoshk
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

Re: Problem getting value of "Where Within Source"

Posted: 08 Jun 2015 11:11
by tatewise
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