If I create a new OBJE record from within a plugin I either get duplicate FORM and _FILE fields or blanks.
e.g. If I do:
local objFILE=fhCreateItem('TITL',objOBJE) fhSetValueAsText(objFILE, 'mytestfile.jpg')
... the record is created with 2 FILEs - one blank and one with the test file in it.
I thought it might be because the FILE and FORM were mandatory and so pre-set so tried this instead:
local objFILE=fhGetItemPtr(objOBJE,'_FILE')
fhSetValueAsText(objFILE, 'mytestfile.jpg')
That gets rid of the duplicate FILE but doesn't set the test file at all.
I even tried deleting it and re-creating or re-setting it in the code but no joy.
Is this a bug or am I doing something wrong?
ID:5822
* How to create _FILE and FORM fields in OBJE record
- Jane
- Site Admin
- Posts: 8440
- Joined: 01 Nov 2002 15:00
- Family Historian: V7
- Location: Somerset, England
- Contact:
How to create _FILE and FORM fields in OBJE record
You need the 'navigation' data reference for the get eg:
local objFILE=fhGetItemPtr(objOBJE,'~._FILE')
I would also check if objFile is nil and if it is then create it.
Also make sure you have Beta 5.0.4 and not an earlier one, as I thought the latest version did not add title and filem but I have not double checked it.
local objFILE=fhGetItemPtr(objOBJE,'~._FILE')
I would also check if objFile is nil and if it is then create it.
Also make sure you have Beta 5.0.4 and not an earlier one, as I thought the latest version did not add title and filem but I have not double checked it.
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."
How to create _FILE and FORM fields in OBJE record
The ~ solved it - many thanks 