I know it's a stupid question, but I can't find the answer, so...
I have the following code:
pNote = fhGetValueAsLink(pi, '~.NOTE2')
where pi points to a _PLAC record. I've tried several variations on the data reference. All return 'null'. I guess I'm missing a period or something.
Can you help?
Thanks,
Shosh
* Getting the pointer to a _PLACE note
-
shoshk
- Famous
- Posts: 242
- Joined: 13 May 2015 16:28
- Family Historian: V7
- Location: Mitzpe Jericho, Israel
Getting the pointer to a _PLACE note
Shosh Kalson
-
shoshk
- Famous
- Posts: 242
- Joined: 13 May 2015 16:28
- Family Historian: V7
- Location: Mitzpe Jericho, Israel
Re: Getting the pointer to a _PLACE note
OK. Really was a stupid question.
I forgot that I had to create the note if it didn't exist.
All works now.
Shosh
I forgot that I had to create the note if it didn't exist.
All works now.
Shosh
Shosh Kalson
- Jane
- Site Admin
- Posts: 8441
- Joined: 01 Nov 2002 15:00
- Family Historian: V7
- Location: Somerset, England
- Contact:
Re: Getting the pointer to a _PLACE note
Were you meaning strText =fhGetValueAsText(ptr) as NOTE2 is a local note there should be no link to another record.
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."
-
shoshk
- Famous
- Posts: 242
- Joined: 13 May 2015 16:28
- Family Historian: V7
- Location: Mitzpe Jericho, Israel
Re: Getting the pointer to a _PLACE note
Ok, still having a problem.
pNote = fhGetValueAsLink(pi, '~.NOTE2') always returns null.
So then I
if pNote:IsNull() then
pNote = fhCreateItem('NOTE2', pi)
end
fhSetValueAsText(pNote, sNote)
which creates a new note for the place. Every time I run the plugin. Which is not what I want. Argh!
pNote = fhGetValueAsLink(pi, '~.NOTE2') always returns null.
So then I
if pNote:IsNull() then
pNote = fhCreateItem('NOTE2', pi)
end
fhSetValueAsText(pNote, sNote)
which creates a new note for the place. Every time I run the plugin. Which is not what I want. Argh!
Shosh Kalson
- Jane
- Site Admin
- Posts: 8441
- Joined: 01 Nov 2002 15:00
- Family Historian: V7
- Location: Somerset, England
- Contact:
Re: Getting the pointer to a _PLACE note
As I said you can't get a "link" to the Note as the note2 is local and and not a separate record.
Try the following
Try the following
Code: Select all
local pNote = fhNewItemPtr()
pNote:MoveTo(pi,'~.NOTE2')
if pNote:IsNull() then
pNote = fhCreateItem('NOTE2', pi)
end
fhSetValueAsText(pNote, sNote)
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."
-
shoshk
- Famous
- Posts: 242
- Joined: 13 May 2015 16:28
- Family Historian: V7
- Location: Mitzpe Jericho, Israel
Re: Getting the pointer to a _PLACE note
Got it working. The correct syntax is:
pNote = fhGetItemPtr(pi, '~.NOTE2')
Thanks for helping.
Shosh
pNote = fhGetItemPtr(pi, '~.NOTE2')
Thanks for helping.
Shosh
Shosh Kalson